This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I2C INTERRUPTS

Hello People,

I have a just got a small problem with I2C Interrupt . The I2DAT Register is
reading only one memory location 0x00 from my slave always. My slave has data
from 0x00 to 0x24 memory location which is configured correctly on its end.

Below is my ISR Routine that I have developed .

__irq void I2C_IRQHandler(void)
{ switch(I21STAT)
{ case 0x08:
I21CONCLR = 0x20;
I21DAT = 0x23 ; //my slave address fed as 0x23(read)
break;

case 0x18:
I21DAT = 0x00; //start addr points slave data
break;

case 0x20:
I21DAT = 0x22; // if its SLA+W+ACK (write)
break;

case 0x28:
I21CONSET = 0x10;// if its SLA+W+NACK (write)
break;

case 0x40:
I21CONSET = 0x04;// if its SLA+R+ACK
break;

case 0x48:
I21CONSET = 0x20;// if its SLA+R+NACK
break;

case 0x50:

Data_Reg = I21DAT; //I store read data in a local var
I21CONSET = 0x10;
break;

case 0x58:
I21CONSET = 0x20;
break;

default :
break;

}

I21CONCLR = 0x08; // Clear I2C Interrupt Flag
VICVectAddr = 0; // Acknowledge Interrupt

}

I am just fetching data from slave and reading it using my master .

Can you people pls help me on this issue , Thank you for all your Support.

Regards,
Samjith.A

0