Hi there. I am trying to write data to an eeprom (24c32a) through i2c. I am using the C18 library. I went through the steps in the datasheet and I can't figure out what im doing wrong.
datasheet: https://www.electro-tech-online.com/custompdfs/2009/09/21163E.pdf
what im trying to do is write the value 0xAA to the address 0x0000 and then read it back on the LCD.
thanks
datasheet: https://www.electro-tech-online.com/custompdfs/2009/09/21163E.pdf
what im trying to do is write the value 0xAA to the address 0x0000 and then read it back on the LCD.
Code:
void main(void)
{
OSCCON = 0b01110010;
TRISCbits.TRISC3 = 1;
TRISCbits.TRISC4 = 1;
OpenI2C(MASTER, SLEW_OFF);
StartI2C();
WriteI2C(0xA0);
WriteI2C(0x00);
WriteI2C(0x00);
WriteI2C(0xAA);
StopI2C();
StartI2C();
WriteI2C(0xA1);
WriteI2C(0x00);
WriteI2C(0x00);
write = ReadI2C();
NotAckI2C();
StopI2C();
prnt(write);
while (1);
}
thanks
Last edited: