Pages: [1]   Go Down
Author Topic: Understanding EEPROM size  (Read 998 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 250
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 217
Posts: 13718
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Rob Tillaart

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

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 250
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 485
Posts: 18800
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Positions 0-4095 contain data 0-255. That's not quite what you said.
Logged


0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 250
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok thanks alot!
Logged

Pages: [1]   Go Up
Jump to: