Go Down

Topic: Understanding EEPROM size (Read 1 time) previous topic - next topic

acmiilangr

Hi.

I am comfused about eeprom size of arduino. for example, i am using arduino MEGA that have 4KB (4096bytes)
i need to write and read numbers in specific place of eeprom
i am using this code:

Code: [Select]
int eeprom_data_position;
int eeprom_data;

EEPROM.write(eeprom_data_position, eeprom_data);

//for example
EEPROM.write(1256,212); //on position 1256 write the number 212


if EEPROM have the size of 4096bytes doesnt that means that i can store on position 0-4095 values 0-255?
why when i am trying to store on position that is more than 4095 it still works? (for example EEPROM.write(8022,252), if after this i try to read position 8022 it reads sussesfull the data 252.
is this becouse it actually it writes data in some other position bettwen 0-4095?
please somenone explain me

robtillaart

it wraps around so position 8022 ==> 8022 - 4096 = 3926

fill the eeprom with 00 and write 255 to 8022 and then read back the whole 4K

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

acmiilangr

so there is position 0-4096 with data 0-256 right?

Nick Gammon

Positions 0-4095 contain data 0-255. That's not quite what you said.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

acmiilangr


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