One of the aspects that must be taken into account before starting to program the sketch, is that when dealing with an EEPROM memory you have to work with memory addresses.Įach time a value is written or accessed in the EEPROM, the memory address must be specified.
So first of all, if we intend to use this library, we must first include it at the beginning of the sketch. To work efficiently with the EEPROM memory within the sketches, the Arduino editor, Arduino IDE, provides us with a library that provides us with many functions that facilitate the task of reading and writing on it: the EEPROM library. In fact, the EEPROM memory has been designed for other purposes than RAM, and therefore the access and write times are much slower than the latter. This is for a variety of reasons… not just the possibility of not being able to rewrite the cells over and over again, but above all performance talk. So an important aspect of EEPROMs to take into consideration is that of not using them for reading and writing common variables, which instead must be done on RAM. An example of how it could be used on Arduino is to save a particular configuration or set of recovery data, in order to be able to restart the next time the board is reactivated from a particular point (recovery of the previous session). We therefore understand that the EEPROM has a rather particular function. It therefore has a function very similar to that of a hard disk for a computer, where data files are stored to be able to preserve them over time. The EEPROM memory is used to store data and parameters that must be used even after the device is turned off. These will vary in content throughout the duration of the execution, the variables can be created and destroyed and once the device is turned off, the entire memory with the data inside will be deleted.
The RAM memory is used to contain the values of the variables defined in the sketch code and which are necessary for the correct execution of the program. FLASH memory such as EEPROM memory also retains information after the card is turned off. When the Arduino board is powered on, it will read the code to execute here. Once the code is uploaded, it will remain unchanged until the next upload (new compiled code). The FLASH memory is the one used by Arduino to store the sketch code once compiled. To do this, Arduino has three different types of memory available: What are the EEPROMs on Arduino for?Īrduino boards, like all processors up to the computers themselves, need memory in order to store information. Well the manufacturers affirm a time limit of 10 years, but this period can vary depending on the state of conservation and the temperature in which the microchip is stored. The same thing is the duration of time in which a cell is able to keep the data in the absence of current. However, it is also important to take this into account in particular applications. But nothing to worry, as it involves around a million rewrites.
Small curiosity about EEPROM: in reality there is a limit of times in which the memory cells present inside it can be rewritten. It is also possible to expand the size of the EEPROM memory available by using special Microchips to be connected to the board and which use the I☬ protocol to communicate (see Microchip 24LC1025). In particular, the size will depend on the type of processor used by the board. So every Arduino board is equipped with this kind of memory, even if depending on the model their size will be different. So we often talk about EEPROM memory, similarly to what we refer to RAM memory. Many controllers, as well as those used for Arduino, such as the ATMega328, have EEPROM chips inside that allow you to keep a set of useful data even after the device is turned off. That is, they are memory devices that, unlike RAM, are able to keep information inside them even after the power supply has been turned off. The next time it is turned on, the device will then have data available to be loaded. EEPROMs, which are the acronym for Electrically Erasable Programmable Read-Only Memory, are special microchips used to store data even after the device on which they are mounted has been turned off.