- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Understanding memory types in Arduino Uno
Arduino Uno, or any other microcontroller for that matter, generally has 3 types of memory −
Flash
This is where Arduino sketch is stored.
Any variable defined using PROGMEM or the F() macro is also stored here. Note that such variables are immutable by default, i.e., their values can't be changed at runtime.
Flash memory is non-volatile (i.e., the stored content is not lost even after power is turned off)
It is slower to access than SRAM, but since it is much larger in size than SRAM, some immutable strings/ arrays can be stored here to avoid overflow of SRAM.
It generally has 10,000 read/write cycles.
SRAM
This is where the normal variables of the sketch are created, stored and manipulated.
SRAM is volatile, i.e., the stored content is lost as soon as the power is turned off
SRAM is very quick to access.
It has practically unlimited read/write access.
EEPROM
Like Flash, EEPROM is also a non-volatile memory.
EEPROM can be used to store long term information irrespective of the sketch in the Flash (like some config variables to be used across sketches)
EEPROM is the slowest to access among all three memory types.
It generally has 100,000 read/write cycles
Arduino Uno has ATmega328P, which has the following specifications −
Flash − 32 kb
SRAM − 2 kb
EEPROM − 1 kb