Go Down

Topic: EEPROM library (Read 771 times) previous topic - next topic

frikosal

Hi,
I suspect that it I call EEPROM.write(addr) and addr is a number larger than the memory size, the higher order bits are just discarded.
Is it so?
Do you think it would it be nice to have a MAXEEPROMADDR constant defined as the last valid address, that would change depending on the board, so that I can write a code that runs on different arduinos, for instance the different versions of the NANO ?
Otherwise a small data logger, for instance, would destroy previously stored values.
What do you think ?

Coding Badly

I suspect that it I call EEPROM.write(addr) and addr is a number larger than the memory size, the higher order bits are just discarded.
Is it so?


Yes.

Quote
Do you think it would it be nice to have a MAXEEPROMADDR constant defined as the last valid address, that would change depending on the board, so that I can write a code that runs on different arduinos, for instance the different versions of the NANO ?


Put this at the top of your Sketch and you'll be good to go...

#define MAXEEPROMADDR E2END

Or, you can just use E2END.

frikosal

Just tried, it works. Thanks !
Is that E2END constand described somewhere in the reference ?

Coding Badly

http://www.nongnu.org/avr-libc/user-manual/group__avr__io.html

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy