thunaivendan
Member level 3
- Joined
- Apr 19, 2013
- Messages
- 61
- Helped
- 0
- Reputation
- 0
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Chennai, Tamil Nadu, India
- Activity points
- 1,733
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
void EEPROM_Write(char Data, unsigned char Address)
{
I2C_Start();
I2C_Write(SlavewriteAddress);
I2C_Write(Address); // Address to write data
I2C_Write(Data);
I2C_Stop();
TDelayms(5);
}
char EEPROM_Read(unsigned char Address)
{
I2C_Start();
I2C_Write(SlavewriteAddress);
I2C_Write(Address); // Address to write data
I2C_Restart();
I2C_Write(SlaveReadAddress);
EEPROMREAD = I2C_Read();
I2C_ACK(0); // NACK
I2C_Stop();
}
Hello friend,
I have seen your whole code, i think you have one mistake in i2c_address function of your code
My suggestion is:
Change this line of code
l_address=address<<1; Here, address = 0xA0, after code execute, l_address = 0x40
l_address+=mode; Here, l_address = 0x41 or 0x40 according to mode.
With
l_address = address | mode; Here, l_address = 0xA1 or 0xA0 according to mode.
Hope this is help you,
Regards,
Ghanshyam