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

Data Memory in The 8051 Microcontroller

Uploaded by

Abhishek Perera
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Data Memory in The 8051 Microcontroller

Uploaded by

Abhishek Perera
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Data Memory in the 8051 Microcontroller

Data memory, specifically RAM (Random Access Memory), is a crucial component of the
8051 microcontroller. It is a volatile memory, meaning its contents are lost when power is
removed. The 8051's data memory is primarily used for temporarily storing data during
program execution, such as sensor readings (like the water level in a washing machine) or
intermediate calculation results.

While the 8051 does have internal RAM, its size is not 384 bytes. The basic 8051 model has
128 bytes of internal RAM, while enhanced versions like the 8052 offer 256 bytes. This
internal RAM is divided into three distinct areas:

Lower 128 Bytes - This area is further divided into,

Register Banks: These are sets of general-purpose registers (R0-R7) used for storing
variables and performing calculations. The 8051 has four register banks, and the currently
active bank is selected using bits in the Program Status Word (PSW) register.

Bit-Addressable Area: This area allows direct manipulation of individual bits, which is
useful for tasks like controlling I/O pins or implementing boolean logic.

Upper 128 Bytes (If Available) - This area is present only in 8051 variants with 256 bytes of
internal RAM. It can be used for general data storage, as extra register banks, or as stack
space for storing temporary data and return addresses during function calls and interrupts.

Special Function Registers (SFRs) - These registers are not part of the general-purpose
RAM. They are used to control and interact with the 8051's peripherals, such as timers,
counters, and the serial port. Each SFR has a specific address and function, and they are
accessed using direct addressing.

For applications with larger data storage needs, like a washing machine control system, the
internal RAM might not be sufficient. In such cases, the 8051's data memory can be
expanded using external RAM. The 8051 can address up to 64K bytes of external data
memory using the MOVX instruction and either the Data Pointer (DPTR) register for full
addressing range or R0/R1 registers for accessing smaller blocks (256 bytes) of external
RAM.

What are the different types of internal data memory in the 8051 microcontroller, and how
are they used?

The internal RAM (Internal data memory) can be divided into different types according to
the areas that are belonged in internal RAM.
1) Lower 128 bytes
a) Register banks-8051 MCU has four Register banks which each consists eight
registers denoted by R0 to R7. Every register is 8-bit general purpose register. We
can use these register banks to store data temporarily when the program is being
executed. Current active register bank can be selected by using RS0 and RS1 bits
of Program Status Word (PSW) register.
b) Bit-Addressable area- This is a 16 bytes area of the internal RAM. In this area,
each bit has its own address and each bit of this area can be accessed and
manipulated individually and directly. In other words, we can say that these
addresses are bit addressable.
2) Upper 128 bytes

General purpose area-This is an additional 128 bytes area of the internal RAM. This area
is utilized by the microcontroller as an additional general-purpose data storage and
operating stack. This area can be accessed indirectly by using registers.

3) Special Function Registers (SFRs)-These registers are not in general-purpose RAM. They
are used to control the microcontroller’s peripherals allowing the interaction with
hardware features like Timers and I/O ports etc. Also, SFRs can be accessed by using
direct addressing.

You might also like