Unit54. Memory and ATmega Memory Map
Unit54. Memory and ATmega Memory Map
Memory and
ATmega 328P Memory map
1
Sciences and Humanities Types of memories
2. PROM
3. EPROM
Technology
4. EEPROM
FY - Department of Engineering,
5. Flash EEPROM
2
Sciences and Humanities Types of Non-volatile memories
Non-volatile memory
Non-volatile memory (NVM) preserves the data stored in it during periods when the
power to the chip is turned off.
Vishwakarma Institute of
If the information written on ROM goes wrong, the ROM must be discarded. So it is
referred to as OTP One Time Programmable ROM
Technology
ROM (Read-only memory) – This is designed to hold permanent data. It’s normal operation
FY - Department of Engineering,
is read-only and not to write . It is used to store system software which must be
immediately accessible to the computer,
1. MROM (Mask programmed ROM or Mask ROM) – In this type the data is programmed
into the chip when the chip is manufactured, so it is only used for large production runs.
It cannot be rewritten with new data.
3
Sciences and Humanities Types of Non-volatile memories
2. PROM (Programmable read-only memory) – The data is written into a ROM during
manufacture, while with a PROM the data is programmed into them after manufacture.
Vishwakarma Institute of
The data is written into an PROM chip before it is installed in the circuit. The PROMs are
manufactured blank. The chip is plugged into a device called a PROM programmer. For
Technology
4
Types of Non-volatile memories
3. EPROM (UV Erasable programmable read-only memory) –
Sciences and Humanities
a. In this type the data can be rewritten by removing the chip from the circuit
board.
Vishwakarma Institute of
Example : Programming
setup with M27C322
32 Mb EPROM
Technology
FY - Department of Engineering,
In this type the data can be written electrically, while the chip is on the circuit
board, but the writing process is slow.
Technology
This type is used to hold firmware, the low level microcode which runs hardware
FY - Department of Engineering,
devices, such as the BIOS program in most computers, so that it can be updated.
7
Types of Non-volatile memories
SN EEPROM UV-EPROM
Sciences and Humanities
3 In EEPROM one can select which byte is In UVEPROM entire contents get erased
to be erased
Technology
4 We can program and erase the contents Needs to be removed from system
while still it is on system board board for erasing data or for
FY - Department of Engineering,
programming
5 EEPROM does not require an external External programming as well as
programming or erasure device. erasure device is required
6 Number of program and erase cycles is Number of program and erase cycles is
100,000, For RAM and hard disk--infinite 1000
7 Costlier as compared to EPROM Relatively less costlier
8
Types of Non-volatile memories
5. Flash memory –
Sciences and Humanities
3. In this type the writing process is intermediate in speed between EEPROMS and RAM
memory
4. Data can be written on Flash, but not fast enough to serve as main memory. It is often
used to store files
Technology
6. When Flash memory contents are erased, entire device is erased, in contrast to
EEPROM, where desired byte/bytes can be erased.
7. In specially developed Flash memories, the contents are divided into blocks and
erasure can be done block by block, but not byte by byte.
8. It is used in portable devices such as PDAs, USB flash drives, and removable memory
cards used in digital cameras and cell phones.
ATmega328 microcontroller has a Flash-type program memory of 32KB.
9
RAM– Random access
memory
Sciences and Humanities
CPU. Most of the machine code and working data that are modifiable are stored
in RAM. Commercial use of semiconductor RAM started by IBM in 1965
RAM is normally associated with volatile types of memory, The stored
Technology
10
Levels of data memory:
Level 1 or Register
It is a type of memory in which data is stored and accepted that are immediately stored in
Sciences and Humanities
CPU. Most commonly used register is accumulator, Program counter, address register etc.
Vishwakarma Institute of
It is memory on which computer works currently. It is small in size and once power is off data
no longer stays in this memory.
11
Sciences and Humanities
RAM– continued
1. Static Random Access Memory (SRAM) :
SRAM stores information with the help of transistors.
SRAM is called static as no change or action
Vishwakarma Institute of
Data is stored in capacitors. Capacitors that store data in DRAM gradually discharge energy,
no energy means the data has been lost. So, a periodic refresh of power is required in
order to function. DRAM is called dynamic as constant action i.e. refreshing is needed to
keep the data intact. It is used to as main memory.
3. Virtual memory- When a large program or multiple programs are running, it's possible for
memory to be fully used. To compensate for a shortage of physical memory, the
computer's operating system (OS) can create virtual memory. To do this, the OS
temporarily transfers inactive data from DRAM to disk storage.
12
SRAM and DRAM
SN SRAM DRAM
Sciences and Humanities
1 Complex internal circuitry. Hence less Small internal circuitry in the one bit
storage capacity compared to same memory cell. So, in DRAM large storage
physical size of DRAM capacity is available
Vishwakarma Institute of
2 Transistors are used to store information Capacitors are used to store data in DRAM.
in SRAM.
3 SRAM has lower access time. Faster than DRAM has higher access time compared to
Technology
13
Vishwakarma Institute of
FY - Department of Engineering,
Technology Sciences and Humanities
configuration
Atmega 328P
Memory/Registers
14
EEPROM in
Atmega328P
Sciences and Humanities
memory for program storage. Can endure at least 100,000 write/erase cycles.
Nonvolatile.
Technology
• The ATmega328/P Program Counter (PC) is 14 bits wide, thus addressing the
16K program memory locations. (Each location of 16 bits)
• The Flash memory is organized in two main sections, the Application section
and the Boot Loader section.
16
Flash Program Memory map
ATmega328P • The AVR Bootloader is a program that allows a
Sciences and Humanities
ATmega328P
Flash Program Memory map
18
RAM in Atmega328P – Volatile
Data can be accessed through the standard data bus (Load/Store Instructions).
Sciences and Humanities
There is a secondary In/Out Bus for rapid direct access to select locations.
Vishwakarma Institute of
00 –00
1F– 1F 64 I/O registers Used to access peripherals
FY - Department of Engineering,
20 –20
3F– 3F
160 Extended I/O Used to access extra peripherals
registers
0x0100
2048 Used to store temporary
data
Internal SRAM (2K)
0x8FF
19
Sciences and Humanities
RAM in Atmega328P – Volatile
Data address I/O address Contents
0x0000 – 0x001F Registers R0 – R31
Vishwakarma Institute of
bit-addressable)
Extended I/O
FY - Department of Engineering,
20
RAM in Atmega328P – Volatile
Registers (32 bytes) (000016–001F16)
Sciences and Humanities
The 32 general purpose working registers are addressed by their numbers (R0–R31)
Vishwakarma Institute of
This memory can also be accessed by the standard data bus using a 0x20 address offset in the
FY - Department of Engineering,
access command.
Some of the SRAM is used as Extended I/O memory to handle the extra peripherals control
registers and other I/O functions.
For this Extended I/O space in SRAM, only the ST/STS/STD (Store) and LD/LDS/LDD (Load)
instructions can be used.
21
Sciences and Humanities
RAM in Atmega328P – Volatile
Internal SRAM (2048 x 8-bit) (010016–08FF16)
Vishwakarma Institute of
to them, and some operations (like arithmetic, comparisons, etc.) can only be
FY - Department of Engineering,
performed on GP registers.
Other instructions are used to move data between GP registers and SRAM.
I/O registers are a means to manipulate the various peripherals (timers, USARTs,
SPI, etc).
22