I have been working on this problem for several hours and I was thinking that my code was bad. I have looked all over for examples and could not figure it out. I have a function that writes a byte of data to a eeprom location and another that reads that location. I tried all type of casting the variable with the data, but every time that I read the location it showed 255 or 0xFF, which I think is the code for location not written. I was doing the following, remember this is for test purposes, i would put the write function on the program, run it on the chip to save the parameter. Then comment put the write function and uncommented the read function, but it will give me 255.
So I did the following:
eeprom_write_byte((uint8_t *) 10, (uint8_t *)78);
for (int x=0; x<20; x++)
{
lcd_gotoxy(0,0); lcd_int(eeprom_read_byte((uint8_t *)x)); lcd_puts(" "); lcd_int(x);
_delay_ms(500);
lcd_gotoxy(0,0); lcd_puts(" ");
}The display shows 255's in all but address 10, where it shows 78, but if i comment the write statement the whole series is 255, the 78 disappeared from memory.
Is the EEPROM erased every time that the program is loaded on the chip? Is there a trick to make the memory permanent on the chip?
thanks for the help.