Memory types of Microcontrollers

Discussion in 'Embedded Systems and Microcontrollers' started by pujulde, Sep 9, 2013.

  1. pujulde

    Thread Starter Member

    Jul 24, 2013
    In ATmega328 we have 3 memory types each of perfect value :

    • Flash Program Memory: 32 kbytes
    • EEPROM Data Memory: 1 kbytes
    • SRAM Data Memory: 2 kbytes
    • When we write code its stored in the Flash program Memory and program counter increases its value by one and read the program in series if there is no interrupts. It makes logical operations using SRAM as i understand, but whats the use of EEPROM Data Memory can anybody explain?
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    The EEPROM will not loose data then the power is lost. So it can be used to store any information/data during power off. That is needed on next power on. As one example it could be calibration data for some instrument
  3. Eric007

    Senior Member

    Aug 5, 2011
    @pujulde: That's a good question and I sometimes ask myself the same question.

    Yes I know EEPROM does not lose data at power off BUT what does it really mean? because Data and Program memory don't lose the programed data either! I would like to be clarified a bit coz there's definitely something I am missing here.

    Storing data during power off :confused:

    Will have to read datasheet on EEPROM coz I never found a need to use it.

    Pardon my ignorance!
  4. sirch2

    Well-Known Member

    Jan 21, 2013
    You need to think in terms of producing a batch of a given product, not just one.

    Suppose you have a calibration value for a sensor (e.g. a temperature coefficient) which is different for every sensor of that type. It is not efficient to have that calibration value hard-coded in the program because you would have to recompile the program for every unit made. Instead you can write a program that reads the calibration value from the EEPROM so every unit has the same program and then set the calibration value in the EEPROM for each unit individually.

    Another use for it could be user defaults - suppose you have a program that reads a value at a certain time interval. You could allow the user to set the time interval via a keypad for example and then store that in the EEPROM so that after a power off the last used value is retained.
    pujulde and Eric007 like this.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    FYI: Typically any data memory such as SRAM would be lost when the power goes off.
  6. pujulde

    Thread Starter Member

    Jul 24, 2013
    Flash memory is made by the same technology as EEPROM isn't it? As I understand from your reply the EEPROM memory of the mc just separated for additional data preserving
  7. t06afre

    AAC Fanatic!

    May 11, 2009
    Picture your self a car stereo (but not modifying it, as it is not allowed on this forum:p). Then you turn the power off in your car. It remembers all the settings and stations presets. These settings may typical be stored in an EEPROM, for restoring then power comes back.
    Then you look at the datasheet for any PIC(as an example). You will see that EEPROM are rated for more write cycles than the flash type memory. Then writing to flash type memory you kind of wear it out a little bit each time. A few years back it was also needed for technical reasons that the flash part and the EEPROM was separated on the chip. Then programming the flash a programmer was needed. And self programming with a boot loader was not an option. The flash type memory also require that then you do the erase/write operation you have to work on memory blocks. Not as single cells.
    Eric007, absf and pujulde like this.