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

interfacing lpc2148 with 24c02 using i2c protocol

After setting the start bit the SI flag is not getting set.therefore not entering the isr routine. Can anyone tell me why?

void i2c_init()
{
                PINSEL0=BIT4+BIT6; //scl=port0.2 sda port0.3
                IODIR0=BIT2+BIT3;
                I2C0CONSET=BIT6; // enable
                I2C0CONCLR=BIT5+BIT2;
                I2C0SCLH=75;
                I2C0SCLL=75;

        /*i2c interrupt enable*/
        VICIntSelect=0x00;
        VICIntEnable=BIT9;
        VICVectAddr4=(unsigned) slave_addr;
        VICVectCntl4=0x29;
}
void read()
{
        lcd_data('r');
        I2C0CONSET|=BIT5; // START BIT
        lcd_data('s');
}
__irq void slave_addr(void)
{

        I2C0CONCLR=BIT5; // clear the start bit

                switch(I2C0STAT)
                {
                        case 0x08 :
                                        I2C0DAT=0xa0;
                                                        break;
                 }
         I2C0CONCLR=BIT3; // clr si flag
        VICVectAddr = 0x00;
}

int main()
{
        i2c_init();
        lcd_init();
        lcd_data('m');
        read();
}