Why does this code not retain the EEPROM data at locations 0 & 1?
I write to it, read it back and it seems to be there,
write to 1200 other locations,
then read back 0 & 1 and its gone.
What the heck?
case 0x53:
// capital S for saving to EEPROM
SaveMode = SaveMode + 1;
if (SaveMode == 3){ // wait for SSS
//dataEntry = Memory;
SaveMode = 0;
// save length in EEPROM, write displayArray to EEPROM
Serial.print ("saving to EEPROM, displayEnd = ");
EEPROM.write(0, (lowByte (displayEnd)));
EEPROM.write(1, (highByte (displayEnd)));
Serial.print (EEPROM.read(1));
Serial.print (" ");
Serial.println (EEPROM.read(0));
for (x = 2; x<(arraySize); x=x+1){
EEPROM.write(x, displayArray[x]);
Serial.print(x);
Serial.print (" ");
Serial.println (EEPROM.read(x));
}
Serial.print ("EEPROM address 0 = ");
Serial.println (EEPROM.read(0));
Serial.print ("EEPROM address 1 = ");
Serial.println (EEPROM.read(1));
highEEPROM = EEPROM.read(1);
lowEEPROM = EEPROM.read(0);
EEPROMend = (highEEPROM<<8) + lowEEPROM;
Serial.print ("EEPROMend = ");
Serial.println (EEPROMend);
}
break;
Serial monitor:
:
:
Displaying from 140 to 152
Displaying from 140 to 152
saving to EEPROM, displayEnd = 0 152
2 0
3 0
4 0
5 0
6 0
7 0
8 254
9 1
10 6
11 1
12 254
:
:
1196 0
1197 0
1198 0
1199 0
EEPROM address 0 = 0
EEPROM address 1 = 0
EEPROMend = 0
Displaying from 141 to 152
Displaying from 142 to 152
:
: