Page 168 - Programming Microcontrollers in C
P. 168
Microcontroller Memory 153
Microcontroller Memory
Most microcontrollers have memory on-board. The memory is
in the form of random access memory (RAM), read-only memory
(ROM), erasable programmable read-only memory (EPROM), elec
trically erasable read-only memory (EEPROM), and a newer type of
EEPROM memory called FLASH. These memory types are discussed
in the following paragraphs. The discussion of FLASH memory will
be deferred until the chapter on the M68HC08 family.
Random Access Memory (RAM)
In a microcontroller, onboard RAM is static random access
memory. It is always volatile—when the power to the microcontroller
is removed, the contents of this memory disappear. Sometimes, spe
cial provisions are made to deliver power to RAM when the processor
is in the “off” state. This provision is called battery backed- up RAM,
and it is one of the alternative ways that a small amount of important
data can be saved when power is removed from the main system.
The requirement for RAM in typical microcontroller applica
tions is modest to small. Available RAM is usually limited to a few
hundred bytes, and often there will be as little as a few tens of bytes
of RAM. In the design of the microcontroller, price is a major con
sideration. The total silicon area of the computer die often drives the
final price of the component. In most computers, a base page is the
first 256 bytes of memory. This page is unique because it requires
only 8-bits of address to reach any location. Silicon area needed to
construct the address decoding for the upper address bits is not re
quired to address base page memory. Therefore, onboard RAM is
usually located in the computer base page. There are some other
functions that are usually assigned to the base page. Generally, you
will find that the amount of RAM is limited to less than 256 bytes.
Read-Only Memory (ROM)
Programs and other data that can never be changed are stored in
ROM. ROM is programmed during the manufacture of the chip, and
its contents cannot be changed once the microcontroller is delivered
to the customer. The ROM program is installed as a mask layer and
is called masked ROM.