I2C code not working for LPC2138

Jul 09, 2012 0 Replies

Hi all, I wrote a code to read temperature from an temperature sensor through i2c, but, it is not passing even the start condition and becoming infinite loop in the



while(I2C1STAT != 0x08);



Please review my code & specify if i missed any thing. find the code below.



#include #include



void mmc_i2c_init() { put_ch('1'); PINSEL0 |= PINSEL_MMC_I2C; // SELECTING PINS FOR THE FUNCTION OF SCL1 & SDA1 PCONP |= (1 4 ; //storing temperature data in a variable put_ch(0x0A); for (i = 16; i >= 1; i--) { if (temp_reading & ( 1


Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required