EEprom understanding

Hello Arduino,

I have some simple questions about EEProm's. I use them in my arduino to save some parameters. I also use some i2c eeproms. And i wonder why i can only store values from 0-255 ?

Example:
I2c EEprom - 24c04a
Atmega168 inside eeprom

Is there a way to store some full int values like the unix ticks 1255556437 ?

So maybe you can give me a hint ?

Function to write a value into an 24c04a EEprom:

void i2c_eeprom_write_byte( int deviceaddress, int eeaddress, byte data ) {
  int rdata = data;
  Wire.beginTransmission(deviceaddress);
    Wire.send(eeaddress);
    Wire.send(rdata);
    Wire.endTransmission();
}

EEPROM's generally only store 8 bit blocks, or values in each cell from 0 - 255.

Halley had a good solution in this forum to use templates to store multiple things to EEPROM:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1234477290/3#3

Modify that to store to your external EEPROM, and you should be fine...

All computer memory nowadays is addressed in bytes (8 bits). Even the ram and flash inside the arduino is addressed in bytes they are the fundamental building block of computers. If you want to store bit patterns that can represent numbers larger than 255 you have to use more than one byte to do this.

Cissy high level languages like C do this for you, but real men know this is just an illusion. :wink: