I am having a very simple problem when trying to write and read to two differnt addresses in the EEPROM.
I finally tried to write a variable to one address and then change just the address re-download and write it again. It works using the first EEPROM address (0) but fails for any other address??
Here is the code it returns 10 when total cycles is 0 but 0 when total cycles is any other number.??
#include <EEPROM.h> #define EEPROM_SIZE 1 int totalCycles = 0;// counts cycles and is written to memory void setup() { Serial.begin (115200); EEPROM.begin(EEPROM_SIZE); EEPROM.write(totalCycles,);//Reset memory value EEPROM.commit(); } void loop() { EEPROM.write(totalCycles,10); EEPROM.commit(); Serial.println(EEPROM.read(totalCycles)); delay(1000);
Hi James,
You’re saying:
Here is the code it returns 10 when totalcycles is 0 but 0 when total cycles is any other number.??
But that’s perfectly normal, since you say you only want to use a single byte of memory:
#define EEPROM_SIZE 1 EEPROM.begin(EEPROM_SIZE);
So you can only write to address 0
(0x0000
)! 😉
On the other hand, I have the impression that you’re confusing the use of the EEPROM.write()
function. The usage is as follows:
EEPROM.write(address, value);
So, I guess what you’re trying to do is this:
#include <EEPROM.h> #include <Arduino.h> const uint16_t EEPROM_SIZE = 1; const uint16_t EEPROM_ADDR = 0; uint8_t totalCycles; void setup() { Serial.begin(115200); delay(1000); EEPROM.begin(EEPROM_SIZE); Serial.printf("Current counter reading: %d\n", totalCycles = EEPROM.read(EEPROM_ADDR)); Serial.printf("We now increment the counter: %d\n", ++totalCycles); EEPROM.write(EEPROM_ADDR, totalCycles); EEPROM.commit(); } void loop() { Serial.println("Reboot the board now"); while (1); }
Note that, by default, your board’s memory is initialized with 1’s everywhere. So, here, the first value that will be read is:
255 = 0xff = 0b11111111
(the value that is read is encoded on one byte)
Stephane: thanks for answering the code was cliped out of something I was working, I should have re done all the comments and variables.Â
Actually what I was trying to do here was simply write 10 to an address EEPROM read it and print it. and then change the address in the code redownload it read it and print it. totalCycles is the address.
It would be something like taking your code and just changing the
const uint16_t EEPROM_ADDR = 0; to const uint16_t EEPROM_ADDR = 1;
What I want in end is to write 2 variables to 2 locations in EEPROM and recall them.
but I am not understanding something basic about the EEPROM function.
I think I am misunderstanding what EEPROM_SIZE 1 is. I thought it set the size of the number
that could be written to any address (1 byte) now I think it is an "instance" with just one
location (like and array).
Hi James,
Indeed, the name of your totalCycles
variable was confusing…
You have to think of the EEPROM as a large array with 512 cells, where each cell can store a single-byte (8-bit) integer number.
To better understand how to use the EEPROM.write(uint16_t address, uint8_t value)
function, and its effects on the EEPROM, I suggest you look at the following piece of code, and especially at the trace you get on the serial monitor:
#include <EEPROM.h> #include <Arduino.h> // number of bytes in EEPROM "array" we want to use const uint16_t EEPROM_SIZE = 512; // number of columns for display const uint16_t COLUMNS = 16; /** * To reset the EEPROM, here we choose to fill it with 1. * So each cell will contain the single-byte 0b11111111 = 0xff */ void eraseEEPROM() { for (uint16_t addr=0; addr<EEPROM_SIZE; addr++) EEPROM.write(addr, 0xff); EEPROM.commit(); } /** * Here is a small function to inspect the status of the EEPROM * by lining up the cells on the display. You don't necessarily * need to understand how it works here. * * Just consider that we use this function: * uint8_t EEPROM.read(uint16_t address) * to read the current value of the cell that corresponds to address */ void printEEPROMState() { uint16_t addr; uint8_t value; uint8_t rows = EEPROM_SIZE / COLUMNS; Serial.print(" ADDR |"); for (uint8_t col=0; col<COLUMNS; col++) Serial.printf(" +0x%1X", col); Serial.print("\n-------+"); for (uint8_t i=0; i<80; i++) Serial.print("-"); Serial.println(); for (uint8_t row=0; row<rows; row++) { Serial.printf("0x%04X |", row*COLUMNS); for (uint8_t col=0; col<COLUMNS; col++) { addr = col + row * COLUMNS; value = EEPROM.read(addr); Serial.printf(" 0x%02X", value); if (col + 1 == COLUMNS) Serial.println(); } } } /** * Here, we first initialize the EEPROM to better identify * what will happen at each cycle of the loop() function. */ void setup() { Serial.begin(115200); delay(1000); EEPROM.begin(EEPROM_SIZE); eraseEEPROM(); Serial.print("\nInitial state of EEPROM:\n\n"); printEEPROMState(); } void poke(uint16_t addr, uint8_t value) { EEPROM.write(addr, value); EEPROM.commit(); } /** * We'll limit ourselves here to four cycles, just for the demonstration. */ uint8_t n = 4; void loop() { while (n) { // we choose a random address within the limit // of the EEPROM_SIZE we defined above: uint16_t addr = random(EEPROM_SIZE); // and a random integer between 0 and 255: uint8_t value = random(256); Serial.printf("\nWriting 0x%02X at 0x%04X:\n\n", value, addr); // and then write the value down to the randomly selected address poke(addr, value); // and the new status of the EEPROM is displayed. printEEPROMState(); n--; } }
And this is what you get on the serial monitor:
Initial state of EEPROM: ADDR | +0x0 +0x1 +0x2 +0x3 +0x4 +0x5 +0x6 +0x7 +0x8 +0x9 +0xA +0xB +0xC +0xD +0xE +0xF -------+-------------------------------------------------------------------------------- 0x0000 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0010 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0020 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0030 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0040 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0050 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0060 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0070 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0080 | 0xFF 0xFF 0xFF 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0xFF 0xFF 0xFF 0xFF 0xFF 0xFF Writing 0xDA at 0x010C: ADDR | +0x0 +0x1 +0x2 +0x3 +0x4 +0x5 +0x6 +0x7 +0x8 +0x9 +0xA +0xB +0xC +0xD +0xE +0xF -------+-------------------------------------------------------------------------------- 0x0000 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0010 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0020 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0030 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0040 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0050 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0060 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0070 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0080 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0090 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00A0 | 0xFF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xFF 0xFF 0xFF 0x0160 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0170 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0180 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0190 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01A0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01B0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01C0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01D0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01E0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01F0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF Writing 0x7E at 0x01DB: ADDR | +0x0 +0x1 +0x2 +0x3 +0x4 +0x5 +0x6 +0x7 +0x8 +0x9 +0xA +0xB +0xC +0xD +0xE +0xF -------+-------------------------------------------------------------------------------- 0x0000 | 0xFF 0xFF 0xFF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0xFF 0xFF 0xFF 0xFF 0xFF 0x0180 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0190 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01A0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01B0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01C0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01D0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7E 0xFF 0xFF 0xFF 0xFF 0x01E0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01F0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF Writing 0x67 at 0x01E8: ADDR | +0x0 +0x1 +0x2 +0x3 +0x4 +0x5 +0x6 +0x7 +0x8 +0x9 +0xA +0xB +0xC +0xD +0xE +0xF -------+-------------------------------------------------------------------------------- 0x0000 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0010 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0020 | 0xF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 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01A0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01B0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01C0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01D0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7E 0xFF 0xFF 0xFF 0xFF 0x01E0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x67 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01F0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF Writing 0x84 at 0x009F: ADDR | +0x0 +0x1 +0x2 +0x3 +0x4 +0x5 +0x6 +0x7 +0x8 +0x9 +0xA +0xB +0xC +0xD +0xE +0xF -------+-------------------------------------------------------------------------------- 0x0000 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0010 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0020 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x0030 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0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 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01C0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01D0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x7E 0xFF 0xFF 0xFF 0xFF 0x01E0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x67 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x01F0 | 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0xFF
Do you see better now how to use the EEPROM?
I prefer to let you find the solution by yourself first.
But if you can’t, please come back and I will help you.
Hi James,
Glad to know you finally got to solve your problem.
To end the discussion, I think you can do it with the selector that appears on your initial post.
Regards,
Steph
Hi,
#include <EEPROM.h> #include <Arduino.h>
Strange enough this code works on esp32 ……. wich has no real eeprom?
To what real  address would be EEPROM.write(addr, value);  providing that address would equal 9? Â
0x109?