Nagarathna
New Member
Hi,
Below is code for inbuilt I2C cofiguration in ARM (LPC2124)
When i run the code the control goes to ISR but the execution doess not come out of ISR and cannot find where the control is going.
I have posted the code if there is any changes to be made please infom
thanks for any reply in advance
Below is code for inbuilt I2C cofiguration in ARM (LPC2124)
When i run the code the control goes to ISR but the execution doess not come out of ISR and cannot find where the control is going.
I have posted the code if there is any changes to be made please infom
thanks for any reply in advance
Code:
#define START I2CONSET=0x60; /* Send start bit */
#define ENABLE_I2C I2CONSET=0x60; /* ENABLE I2C bit */
#define SI_START_DISABLE I2CONSET=0x28; /* START AND SI DISABLE */
#define SLAVE_ADDR I2ADR=0xA0; /* MEMORY IC ADDRESS */
#define SLAVE_MEM_LOCATION I2ADR=0x00; /* MEMORY LOCATION ADDRESS */
#define SLAVE_DATA I2DAT='A'; /* DATA TO BE TRANSMITTED */
void main()
{
unsigned char c;
VPBDIV=2; // cclk=pclk/4; cclk=crystal*5=(11.0592M*5); vpbdiv 00=1/4 * pclk, 01=pclk,10=1/2 * pclk
PINSEL0=0X00050000; //ENABLE RX0(21),TX0(19)
U1LCR=0X83; //LINE CONTROL REGISTER WORD LENTH 8 BIT, 1 STOP BIT
U1DLL=0xb4; //0x1e;//90; //0x5A //0x1e
U1LCR=0X03; //disable divisor access latch bit
send_string("WELCOME EMBED INNOVATION,JAYA NAGAR");
sendchar(0x0d);
sendchar(0x0a);
Initialize ();
while(1)
{
ENABLE_I2C;
START; //transmit a character
}
}
void Initialize()
{
PINSEL0 =0x50; /* Initialize Pin Connect Block */
I2CONCLR=0x6c; /* clearing all flags */
I2SCLH =0x0039; /* 100 KHz */
I2SCLL =0x0039;
VICIntSelect = 0x00000000; /* selecting IRQ 0=IRQ 1=FIQ */
VICVectAddr0 =(unsigned long) I2C_ISR;
VICVectCntl0 = 0x20 | 9; / * highest priority and enabled */
VICIntEnable = 0x00000200; /* enabling I2C 9TH IS ASSIGNDE TO I2C REFER PERIPHERALS IN DEBUG MODE*/
}
void I2C_ISR(void)
{
int temp=0;
temp=I2STAT;
switch(temp)
{
case 8:
ISR_8();
break;
case 24:
ISR_18();
break;
case 40:
ISR_28();
break;
default :
break;
}
VICVectAddr0=0xFF;
}
Last edited: