thanks for your reply, and sorry i put the topic in the wrong forum

I was more interested in if there was something obvious i was missing. I tried your 2 code examples and the work like a charm.
I noticed my code was slightly different than your since i am storing ints instead of bytes (need bigger numbers for the application). Then i tried changing the code to do the exact same thing, except for changing the data type and using extEEPROMwriteInt and extEEPROMreadInt instead. Then i saw a very different value read back from EEPROM compared to expected values. I wrote data using:
#include <Wire.h>
#include <Extensive_EEPROM.h>
const int EEPROM_addr = 0x50;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);
while(!Serial.available()){
Serial.println("Enter any key to begin EEPROM test");
delay(1000);
}
Serial.println("//byte-wise writing");
for(int i = 0; i < 32; i++) {
extEEPROMwriteInt(EEPROM_addr, i, i);
Serial.print("write data= ");
Serial.println(i);
}
Serial.println("Writing Bytes to EEPROM finished!");
}
void loop()
{
}
and i read them back using:
#include <Wire.h>
#include <Extensive_EEPROM.h>
const int EEPROM_addr = 0x50;
void setup()
{
Wire.begin(); // join i2c bus (address optional for master)
Serial.begin(9600);
while(!Serial.available()){
Serial.println("Enter any key to begin EEPROM test");
delay(1000);
}
Serial.println("//byte-wise reading");
int data_back;
for(int i = 0; i < 32; i++) {
data_back = extEEPROMreadInt(EEPROM_addr, i); //byte extEEPROMread(int chip_address, int address);
Serial.print("expected data= ");
Serial.print(i);
Serial.print(" read_back= ");
Serial.println(data_back);
}
Serial.println("Read back test finished!");
}
void loop()
{
}
Basically the exact same sketches as you just posted, but with the 2 functions changed to writing ints instead of bytes. But the output when doing this is very different:
Enter any key to begin EEPROM test
Enter any key to begin EEPROM test
//byte-wise reading
expected data= 0 read_back= 50331648
expected data= 1 read_back= 67305472
expected data= 2 read_back= 84148992
expected data= 3 read_back= 100992003
expected data= 4 read_back= 117835012
expected data= 5 read_back= 134678021
expected data= 6 read_back= 151521030
expected data= 7 read_back= 168364039
expected data= 8 read_back= 185207048
expected data= 9 read_back= 202050057
expected data= 10 read_back= 218893066
expected data= 11 read_back= 235736075
expected data= 12 read_back= 252579084
expected data= 13 read_back= 269422093
expected data= 14 read_back= 286265102
expected data= 15 read_back= 303108111
expected data= 16 read_back= 319951120
expected data= 17 read_back= 336794129
expected data= 18 read_back= 353637138
expected data= 19 read_back= 370480147
expected data= 20 read_back= 387323156
expected data= 21 read_back= 404166165
expected data= 22 read_back= 421009174
expected data= 23 read_back= 437852183
expected data= 24 read_back= 454695192
expected data= 25 read_back= 471538201
expected data= 26 read_back= 488381210
expected data= 27 read_back= 505224219
expected data= 28 read_back= 522067228
expected data= 29 read_back= 2039325
expected data= 30 read_back= 7966
expected data= 31 read_back= 285212703
Read back test finished!
I tried writing and reading several times and the error is somewhat consistent: If i power off the DigiX and then power it back on, the values read are the same (although still not the right values).
However if i run the first sketch again to re-write the same values to the EEPROM, i get completely new, random values.
What could cause such a large deviation from to occur? Is there something i am missing regarding the datatype? I dont see what it would be though since it is ints being passed to the function.
Any ideas would be greatly appreciated
