I wrote a program to dump the contents of the EEPROM (am I reinventing the wheel...again) ?
Works well except for one thing .... there are locations that seem to be missing ????
/* Program: EEPROM Dump
This program prints the contents of the EEPROM in HEX */
#include <EEPROM.h>
unsigned long addr;
byte i;
void setup()
{ Serial.begin(9600);
do
{
/* ------ Print the address padded with spaces ------ */
Serial.println("");
if (addr<1000) {Serial.print(" ");}
if (addr<100) {Serial.print(" ");}
if (addr<10) {Serial.print(" ");}
Serial.print (addr, DEC);
Serial.print (" ");
/*------- Print the Hex Values in groups of 16 ---------*/
for (i=0; i<16; ++i)
{
Serial.print (EEPROM.read(addr), HEX);
++addr;
}
} while (addr < E2END); // E2END is the end of the EEPROM
// used to check ending address
// Serial.println(addr,DEC);
// Serial.println(E2END,DEC);
}
void loop() { } // do nothing
Now here is the output (or some of it at least).
0 453D456E676C6973682C20463D467265
16 6E63682C20533D5370616E6973682C20
32 493D4974616C69616E2C20413D416C6C
48 0048656C6C6F20576F726C640042
64 6F6E6A6F757220746F7574426F6E6A6F
80 757220746F7574206C65206D6F6E6465
96 00486F486F6C61206D756E646F00
112 4369616F206D6F6E646F000436961
128 6F206D6F6E646F000445008C5
144 001C3D416CFFFFFFFFFFFFFFFFFFFF
160 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
176 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
...
992 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1008 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
I am familiar with non-printing characters but non-value bytes is a new one on me.
I tried adding a delay (upto 100 between each read) in case the EEPROM was really slow.
Same, same ...
This is the code that created the missing bytes.
/* Program: Hello World 005
This program stores our Greeting strings in EEPROM.
These values will remain when the board is turned off. */
#include <EEPROM.h>
/* Addresses in EEPROM */
const word HelpStr = 00; /* EEPROM location 0000 through 0049 */
const word English = 50; /* EEPROM location 0050 through 0074 */
const word French = 75; /* EEPROM location 0075 through 0099 */
const word Spanish = 100; /* EEPROM location 0100 through 0024 */
const word Italian = 125; /* EEPROM location 0125 through 0149 */
const word TheEnd = 150; /* the end of our used EEPROM area */
void setup()
{ storestring (HelpStr, English, "E=English, F=French, S=Spanish, I=Italian, A=All\0");
storestring (English, French, "Hello World\0");
storestring (French, Spanish, "Bonjour tout le monde\0");
storestring (Spanish, Italian, "Hola mundo\0");
storestring (Italian, TheEnd, "Ciao mondo\0");
}
void loop() { } // do nothing
void storestring (word addrstart, word addrend, char greeting[])
{ byte chrcount = 0; // this for the index into our char array
char singlechar; // holds a single character from the array
for (int addr=addrstart; addr<addrend; ++addr) // set the address range to write
{ singlechar= greeting[chrcount]; // get one character
EEPROM.write(addr, singlechar); // write it to the EEPROM
if (singlechar=0) { addr = 999;} // check to see it is string termination
++chrcount; // increment the array index
delay(10); // allow time for EEPROM write to complete
}
}
It is repeatable. I wrote another program (EEPROM _Clobber) That filled the EEPROM with 0xFF.
The hex dump worked perfectly with that.
Then I ran the "Hello World 005" again and got the same result as I had previously.