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 interrupt not taking in lpc2148

sending my whole code.......

#include <LPC21xx.H>
#include"prototype.h"



unsigned char word[10] = {"india-pak"};
unsigned char i = 0;

int main()
{
//      VPBDIV = 1;
        PINSEL0 = 0X00000050;
        VICIntSelect = 0x00000000;
        VICIntEnable = 0X00000200;
        VICVectCntl1 = 0x00000029;
        VICVectAddr1 = (unsigned)i2cISR;

//      lcdInit();
//      lcd_data('s');
        i2cInit();
        I2CONCLR = 0XFF;
        I2CONSET = 0X40;
        I2CONSET = 0X20;



while(1);
}

void i2cInit()
{
        I2CONSET = 0X40;
        I2SCLL     = 0x08;
        I2SCLH     = 0x08;
}

void i2cISR(void)__irq
{
        unsigned char status;

        switch( status )
        {
                case 0x08 :     I2CONCLR  = 0x20;
                                        I2DAT     = 0XA0;
                                        break;
                case 0x18 :
                case 0x20 :     I2DAT     = 'S';
                                        break;
                case 0x28 :
                case 0x30 : if( word[i] != '\0')
                                                I2DAT = word[i++];
                                        else
                                                I2CONSET = 0x10;
                                                i = 0;
                                        break;
        }
 I2CONCLR = 0x08;
 VICVectAddr = 0;
}