EEPROM Questions

so im not sure its clickin for me here. am i doing this right?

In the current exercise im doing, i would like to store a value in eeprom so i can reference it later, eventually i want to move onto storing multiple values.

im using the I2C AT24C256 EEPROMS which are labeled as 32K eeproms.

using ,

EEPROM.write(address, value);

and then write the next value into the next address i would use
addr++

i only get 0-254 addresses so i can store 254 different values.

i think i understand that bit and incrementing the addresses and even how to do this with multiple values stepped at different steps to record two at a time 3 at a time etc. and it step the correct number of address for each value

but this seems to be the same for the 16K eeprom i have also.

i still have 0-254 addresses on either chip right?

so what's the point of buying the bigger eeprom,

is their a way i can i store multiple 3 digit values at the same address and retrieve them? if so how would i do that. what would the code for that look like.

would it be something like, EEPROM.write (address, value1, value2, value3); etc until the address is full.

if not, then, again. why buy the bigger chips? am i not really getting 254 address's on the 16K eeprom?

a bit confused here how to figure out how much i cant stuff into a chip and retrieve it.

what would the formula be to calculate how many values i can store into an eeprom.

say, 3 values for example.

256 addresses divided by 3 values would be 85 with a remainder. but this means i can store 85, 3 segment steps into eeprom.

say 7 values, would be 256 address's divided by 7 values is 36 with a remainder

am i doing this right?

if i am then why bother using a 32 k eeprom over a 16k if im still getting the same number of addresses and value storage.

does the 32k allow larger numbers to be stored at each address then the 16k does?

i have read allot of information and its very confusing as everyone seems to calculate this stuff differently. what standard should i be sticking to?

TIA

Which Arduino do you have? If something like the Uno R3, you may be accessing the internal EEPROM. Post the code, using code tags, and describe your wiring.

Use the AT24c156 library instead, and connect the module to the I2C pins. Tutorials can be found on line.

What makes you say that? The address is an int and can hold larger numbers.

You will have as many addresses available as there are bytes in the EEPROM.

Sometime EEPROM capacity is expressed in bits, you wou,d have that number divided by eight number of bytes.

32K bits would be 4K bytes, use addresses 0 to 4095.

a7

1 Like

i was under the understanding that the address value was limited to 256 like the value was.

no where have i read that the address range could reach that high.

Thank you for that bit of important info.

as for how i am calculating how many values i can store. am i doing that correctly?

jremington.

I used caps out of habit. apologies

with the library added
#include <AT24C256.h>

AT24C256 eepromext(0x50);

i would use

eepromext.write (address, value);

not

EEPROM.write(addressm value);

to store values in the external eeprom chip and not in the arduinos internal eeprom

TBH I made no sense of your musings.

It's pretty simple. The one you mention is 256K bits, or 32K bytes.

The number of values you can store, if they are byte sized, is 32768 or 32K.

If you are storing data types that are larger, you would be able to store fewer, let me hope that is obvious.

So if you were storing 16 bit integers, the size of an int type variable, each would take two bytes and you could store 16384 of them. Each would take two bytes, usually one byte and the very next one would be stored and retrieved together.

And so forth. I am unfamiliar with eepromext.write(). I'm looking through the tiny window just now; if no one has helped with any subtleties or details about that, I will when I am in the lab.

In the meantime, look at the documentation for that library and read (and try!) any example code that comes with it.

HTH

a7

eepromext() is just the name assigned when the eeprom is attached with the eeprom library, the 32k eeprom im using is a I2C device and thats how it lables it with

AT24C256 eepromext(0x50); where 0x50 is the I2C address of the chip

eepromext is used in place of EEPROM which refers to the arduinos internal eeprom

the math i was trying to make sense of. was each address can store a 3 digit value from 0-254

so if i have 4095 addresses as you had mentioned in a 32k

then i can store 4095 separate 3 digit values in range of 0-254 into it by changing the value on the address.

example.

eeprom.write(0, 123); would store value 123 at address 0

where i got confused was i was not grasping that the address value can exceed 254.

so instead of being limited to.

eeprom.write(254, 123); //Storing a value of 123 at address 254

on that 32k eeprom which is 4 k

i can go as high as

eeprom.write(4095, 123); which would write value 123 into address 4095

/\ am i understanding that correctly?

only instead of erpom.write, i use the call that I2C library i am using requires to write the data into an external eeprom on the i2c buss instead of writing it to the arduinos internal eeprom.

Am i on the write track here?

Yes yes. It isn't a bit complicated once you understand it!

The only thing I noticed was the number 254. All those should be 255. The value of bytes you store and interpret as numbers is 0..255 by which is meant 0 to 255 inclusive.

Well Imma bet you won't have to change anything. Except to be sure you have the device on the I2C bus.

The methods whatever library you use on whatever EEPROM should be transparently perfect abstractions of non-volatile memory.

They called the object eepromext, but they could have called it macaroni. You just read and write using the object representing EEPROM.

a7

1 Like

Thanks :smiley:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.