Sundar Raju
Newbie level 2
- Joined
- Mar 30, 2014
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 24
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 void I2C_Initi(void); __irq void I2C_ISR(void); void ISR_8(void); void ISR_18(void); void ISR_10(void); void ISR_28(void); int i,Temp,f; int main() { PINSEL0&=0xFFFFFF0F; PINSEL0|=0x00000050;// using i2c0 I2C_Initi(); I2C0CONSET|=0x20;/* Send start bit */ while(1) { IOCLR0=0x40; IOSET0=0x40; //post indicators } } void I2C_Initi(void) { I2C0CONCLR=0X6C; I2C0CONSET=0X40; I2C0SCLH= 0x01; I2C0SCLL= 0x90; VICVectCntl0 = 0x20 | 9; VICIntEnable |= (1<<9); VICVectAddr0 = (unsigned long)I2C_ISR; } __irq void I2C_ISR() { Temp=I2C0STAT; switch(Temp) { case 0x08: ISR_8(); break; case 0x18: ISR_18(); break; case 0x28: ISR_28(); break; } VICVectAddr = 0xff; } void ISR_8(void) { I2C0DAT=0x60; //slave address// I2C0CONSET=0x04; I2C0CONCLR=0x08; } void ISR_18(void) { I2C0DAT=0x32 ; // sample data I2C0CONSET=0X04; I2C0CONCLR=0x08; } void ISR_28(void) { I2C0DAT=0x24 ; // next data I2C0CONSET=0X04; I2C0CONCLR=0x08; }
i am using two lpc2148. one as master and other as slave. afterthe address acknowldgement form the slave. no data has been send.
any suggestions
Last edited by a moderator: