Neckruin
Joined: 17 Jan 2006 Posts: 66
|
Error in 24512.c driver |
Posted: Tue Dec 12, 2006 7:19 am |
|
|
Hi all,
I've been trying to use the 24512.c driver with a 24LC512 serial EEPROM from MicroChip and I have detected a problem.
When doing more than one single byte write into the memory, only the first byte was correctly written. I have modified the code of the write_ext_eeprom() function and now it works.
This is the new code for that function:
Code: | void write_ext_eeprom(int16 address, int8 data) {
int1 status;
int8 add1;
int8 add2;
add1 = make8(address, 1);
add2 = make8(address, 0);
i2c_start();
i2c_write(EEPROM_WRITE);
i2c_write(add1);
i2c_write(add2);
i2c_write(data);
i2c_stop();
i2c_start();
status=i2c_write(EEPROM_WRITE);
while(status==1)
{
i2c_start();
status=i2c_write(EEPROM_WRITE);
}
i2c_stop(); // I added this line
} |
See you all,
Juanma |
|