EEPROM storage question


I am porting code from a BASIC Stamp setup over to the Arduino language, and one of the facets of the program is writing a variable to memory throughout the program and then reading it when the program starts up. In the BASIC program, I just write to the lowest address (000) on the EEPROM and then read it from there, since BASIC programs are written from the highest memory address down. Is it like this on the Arduino? In other words, is my program going to have an issue if I have something like

EEPROM.write( 0, 8 );
   currentGear = 0 );

Thanks in advance, Evan

Addresses for the Atmel's EEPROM feature have nothing to do with addresses for the program or your program's variables. You won't have any problems overwriting your program or variables accidentally by accessing EEPROM. All EEPROM addresses from 0 to 511 are valid on the ATmega168, and all addresses from 0 to 1023 are valid on the ATmega328.

I think this particular BASIC stamp trick is using unused program memory for nonvolatile storage.

The Arduino's ATmega has an EEPROM area separate from program flash for nonvolatile storage. It's all yours, no need to worry about the program.


Nice, thank you both!