0% found this document useful (0 votes)
30 views

Embedded Systems - Lec 3 - Memory

The document discusses different types of memory used in embedded systems including primary memory, secondary memory, volatile memory, non-volatile memory, RAM, ROM, Flash, and EEPROM. It provides details on memory capacity, addressing, read and write operations, and examples of memory used in AVR microcontrollers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Embedded Systems - Lec 3 - Memory

The document discusses different types of memory used in embedded systems including primary memory, secondary memory, volatile memory, non-volatile memory, RAM, ROM, Flash, and EEPROM. It provides details on memory capacity, addressing, read and write operations, and examples of memory used in AVR microcontrollers.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

EMBEDDED SYSTEMS

MEMORY

Dr. Khalil Ismail Khalil Yousef


Assoc. Prof., Electrical Eng. Dept.
Faculty of Eng., Assiut University
[email protected]
EMBEDDED SYSTEMS
EMBEDDED SYSTEM

Processor

Program Memory
MEMORY
 Memory is a collection of storage cell with associated circuit
needed to transfer information in groups of bits called “Word”.
 Word is entity of bits that move in / out of storage as a unit. It is a
group of 1s or 0s and may represent number, character, or
instruction code.
Data
Memory
The Central
Input/
outside Processing
Output
world Unit (CPU)
Program
Memory

Computer Essentials
MEMORY UNIT CAPACITY
 The internal structure of memory unit is specified by the number
of words it contains and the number of bits (n) in each word.
 The number of address lines control the words that can be saved
in memory (k). The number of words equals 2𝑘.
ADDRESS RANGE
 Each microcontroller has a specific address range.
 An address range is the number of addresses the memory of
the microcontroller has and can access.
HOW TO PURCHASE A MEMORY?
 It is customary to refer the number of words (or Bytes) in
memory with one of the letters K, M, G, and T where:
• Kbyte = 1024 Byte
• Mbyte = 1024 Kbyte
• Gbyte = 1024 Mbyte
• Tbyte = 1024 Gbyte
• …etc.
MEMORY AND CPU
MEMORY AND CPU
MEMORY TYPES
 The most significant distinction between memory devices is how
they are connected to the CPU. There are two ways:
1. Primary memory is directly connected to the CPU.
2. Secondary memory is connected the CPU indirectly.
PRIMARY VS. SECONDARY MEMORY
Slow access in range of
milliseconds
Fast access in range
of nanoseconds Secondary
Memory

Primary
CPU
Memory
Secondary
Memory
Control

CPU has direct access to CPU accesses secondary memory


data in primary memory indirectly through memory
control device
PRIMARY VS. SECONDARY MEMORY
 The CPU is only able to directly access information
stored in primary memory. All instructions and data
must be first transferred to primary memory before the
CPU can process them (cache and registers associated
with the CPU).

 CPU can not access the secondary memory directly, but


it needs a controlling module (interface),
TYPES OF MEMORIES

Volatile: requires Non-volatile: stores


constant power to the information
maintain the stored even without power
information. supply.
MEMORY AND NEEDS
 If you design an electronic lock or an alarm, it would be great to
enable the user to create and enter the password, but it’s useless if
lost every time the power supply goes off. The ideal solution is a
microcontroller with an embedded EEPROM (stores data) and
an embedded Flash EEPROM (stores program/instructions)
WRITE / READ OPERATION
 WRITE to memory is to enter data to be stored or processed
through it. It is a data in operation.

 READ from memory is to get data Program


Memory

from memory. It is a data output Data

operation. Memory

CPU
 To control the Write / Read
operation, a control line is used.
WRITE / READ OPERATION
 Address Bus is used to select a particular location within the
memory chip. The signals my be multiplexed as in the case with
DRAM or non-multiplexed as SRAM.
 Data Bus provides the data to and from the memory chip. In
some cases, it uses separate pins for incoming and outgoing data.
 In others, a single set of pins is used
with the data direction controlled by the
status of chip select signals, the
read/write pin and output enable pins.
WRITE OPERATION
Steps that must be taken to store data into memory are:
1. Apply the binary address to the address lines.
2. Apply the data bits to the data input lines.
3. Activate the Write input.

 The memory unit will take the data


present in the Data line and store it
in the specified Address line.
READ OPERATION
Steps that must be taken to transfer a stored data out of memory are:
1. Apply the binary address to the Address lines.
2. Activate the Read input.

 The memory unit will take the bits


of the selected word by the Address
and apply them into the output Data
lines. The content of the selected
word doesn’t change after reading.
MEMORY AND AVR CPU CORE
AVR MEMORY MAPPING
 Memory Architecture of AVR families
 Program Memory
 Flash

 Data Memory
 RAM
 EEPROM

 External Memory
may be included
ATMEGA SERIES MEMORY EXAMPLES

Type Flash RAM EEPROM

F_END Size, kB RAMEND Size, kB E_END Size, kB


ATmega8 $0FFF 8 $045F 1 $1FF 0.5
ATmega32 $3FFF 32 $085F 2 $3FF 1
ATmega64 $7FFF 64 $10FF 4 $7FF 2
ATmega128 $FFFF 128 $10FF 4 $FFF 4
MEMORY OF ATMEGA16
FLASH (PROGRAM MEMORY)
Program Memory Map
 Reprogrammable non volatile memory to hold
instructions that the microcontroller executes.

 16 KByte (16 K x 8 bits) for the ATmega16.

 Program Counter (PC) is 13 bit wide.

 Divided into:
• Boot program section.
• Application program section.

 AVR MUC have 2 modes: Flash programming and


a flash executing mode.
SRAM (DATA MEMORY)
SRAM Data Memory Map
 Stores the runtime data of the executed program
and the current state of the MCU
 The amount of RAM ranges from 32 byes on
ATtiny 28L to 32 KB on an ATxmega384A1.

 In ATmega16, RAM is split into four


subsections to contain Data Memory as:
• 32 8-bits General Purpose Registers
• 64 8-bits Input/output Registers
• Extended I/O registers
• 1024 8-bits (1 KB) internal data SRAM space
EEPROM
• EEPROM is non-volatile memory.

• Used to store data, mostly, the configurable parameters.


• The amount of EEPROM can range from 32 bytes on an ATtiny
families to 4 KB on an Xmega families.

• 512 byte having an endurance of at least 100,000 write/erase cycles.

• Write access time ≈ 8.5 ms.

• While read  CPU halted for 4 clock cycles.

• While write  CPU halted for 2 clock cycles.


EEPROM
EEPROM
EEPROM
 Global and Local Variables
 Program variables can be global
(accessible to all the functions in the
program) or local (accessible only inside
the function they are declared).
 If not specifically initialized, the global
variables are automatically set to 0 at
program startup.

 To store the integer global variable “a” in


EEPROM at address 0x10
EEPROM
EEPROM
 Status Register (SREG)

You might also like