Hi,
I am working on MCB2300(LPC2387). I have used its sample code for Temperature sensing using I2C and its working fine. Now I have connected EEPROM (AT24C02) with microcontroller to store some data. For that I have used same code and did some changes to write and read data from EEPROM. But its not working properly. Below is changes which I have done.
int main (void) { DWORD i; if ( I2CInit( (DWORD)I2CMASTER ) == FALSE ) /* initialize I2c */ { while ( 1 ); /* Fatal error */ } /* Configure temp register before reading */ for ( i = 0; i < BUFSIZE; i++ ) /* clear buffer */ { I2CMasterBuffer[i] = 0; } I2CWriteLength = 3; I2CReadLength = 0; I2CMasterBuffer[0] = 0xA0; I2CMasterBuffer[1] = 0x00; I2CMasterBuffer[2] = 0x10; /* configuration value, no change from default */ I2CCmd = LM75_CONFIG; I2CEngine(); for ( i = 0; i < BUFSIZE; i++ ) /* clear buffer */ { I2CMasterBuffer[i] = 0; } I2CWriteLength = 2; I2CReadLength = 1; I2CMasterBuffer[0] = 0xA1; I2CMasterBuffer[1] = 0x00; I2CCmd = 0xA0; I2CEngine(); }
Suggest me where I have done mistake. any link of tutorial for R/W data using LPC2387 will be appreciated. Hope for best solution.
Thanks Dhaval
"But its not working properly."
I think if you change your code, it will work properly.