AVR - MEMORY & REGISTERS
AVR micro controllers have THREE types of memories.
1. Flash Memory : The Flash memory is a non-volatile memory, may be considered as its ROM (Read Only Memory) which stores the program (HEX code). Even though named as Read Only Memory, the contents on this Flash Memory may re-written by the programmer. Upto about 10,000 times the contents may be over-written by the programmer and read infinite times. The contents of Flash memory can be locked by the programmer, if requied, so that the contents of Flash memory cannot be read by others. But, it may be over-written with another write command.
2. EEPROM (Electrically Erasable and Programmable Read Only Memory) : This is also non-volatile memory, generally used to save variables either through the program or directly through the programmer. The values can be altered, if required, by the programmer or through the program. Generally, EEPROM have 100,000 write cycles and unlimited read cycles.
3. SRAM (Random Access Memory) is a volatile memory, which is used to store actual values of variables, while the program is active. The space allocation and management of the memory is controlled by the ALU (Arithmatic and Logic Unit) of the processor inside the micro-controller. After compling the program (code), the compiler shows the actual RAM used by the program. If, it crosses the maximum available RAM, then the program may mis-behave. i.e., you can not expect correct results.
REGISTERS may be also consider as specific purpose RAM, which holds the status and control data. Registers are used by the programmer (you), while programming to control Input/Ouput or ADC or Counters or Timers or Communication etc.
Some bits of registers are read only and automatically set by the ALU and most of the the bits in the register(s) have read and write permission. The behaviour and direction of data is set by the programmer in the specific register(s) for proper operation(s) of the program.
All the Registers may not be available in all the micro-controllers. The usage of the spcific register(s) are briefly explained in the next pages where ever is required.