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.
Still doesn't work. None of the WriteI2C functions are returning a 1 which means they are successful. In the datasheet on page 7 at the bottom, doesn't figure 6-1 imply that I could read the current address with:
I don't know why it's not working but when you write to a location it auto increments to the next location. So, your above code was reading location 1.
Have you tried disabling the acknowledges? I sometimes find I2C works better if I dont wait for an acknowledge.....
OK, this is not what you should do in your final production code, but it might get your application running when otherwise it will just sit and sulk at you...
The way I get around this problem is by waiting for an ack,
Code:
//Sends the start and device address.
//If the device is busy then it resends until accepted.
void SendID(char DeviceID){
SendStart();
if(SendByte(DeviceID)==1)
return;
do{
SendRestart();
}while(SendByte(DeviceID)==0);
}