I'm trying to implement more memory writing lifespan when storing a single Boolean Value using ESP8266 integrated (flash) memory with Arduino EEPROM library. A single hardware memory location cannot be changed infinitely and I'm trying to find out an efficient solution to extend the lifespan of the memory usage write cycles on several different (similar) platforms.
Some sources determines that the actual write cycle amount of a single EEPROM memory (bit) location is approx 100k - 1M writes (of course this varies much depending on what hardware is being used). One test I found measured 9584038 passed write cycles with Arduino but still I want to extend the memory write cycles if possible.
As far as I know it is impossible to access single bits with EEPROM library and you are limited just storing and reading 8-bit byte values.
The simplest solution for storing a boolean value with the Arduino EEPROM library could be just store FALSE
as a 0
value and TRUE
as a 1
(for eg.).
The question is: Does this kind of ("bit-shifting") approach (image below) make any difference compared to just writing 0
and 1
values to a single Arduino EEPROM (8-bit) memory address. The idea behind this approach is just to change a single bit when changing the actual Arduino EEPROM memory (8-bit) address value when used as a Boolean value (reverse parity of bits 00000000
= false
, 00000001
= true
, 00000011
= false
, 00000111
= true
, etc.). Or should I drop the Arduino EEPROM library and do this other way? I've tried to figure out what's happening under the hood when using the Arduino EEPROM library and could not understand how it actually works inside the microchip.
"Red Block" represents the changed bit - "DECVAL" is the actual stored Arduino EEPROM unsigned char value. So the actual stored (unsigned) char value cycle would be 0
, 1
, 3
, 7
... 224
, 192
, 128
, 0
, 1
...