I modified the sample code in the FAQ that stores a float in eeprom so that it stores and reads a long int (2 bytes) in eeprom. I suppose you can re-use the for-loops for your app.
Code:
unsigned long READ_LONG_INT_EEPROM(long int n)
{
int i;
long int data;
for (i = 0; i < 2; i++)
*(&data + i) = read_eeprom(i + n);
return(data);
}
void WRITE_LONG_INT_EEPROM(long int n, long int data)
{
int i;
for (i = 0; i < 2; i++)
{
write_eeprom(i + n, *(&data + i) ) ;
}
}
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum