Pages: [1]   Go Down
Author Topic: EEPROM storage question  (Read 900 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Howdy,

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
Code:
EEPROM.write( 0, 8 );
   currentGear = EEPROM.read( 0 );

Thanks in advance,
Evan
Logged

Connecticut, US
Offline Offline
Edison Member
*
Karma: 2
Posts: 1036
Whatduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

-j

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 7
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice, thank you both!
Logged

Pages: [1]   Go Up
Jump to: