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

Microcontroller and Embedded Systems

The document provides an overview of the memory organization of the 8051 Microcontroller, detailing its Program Memory (ROM) and Data Memory (RAM). It explains the structure and addressing of both internal and external memory, including the specific roles of Working Registers, Bit-Addressable Area, General Purpose RAM, and Special Function Registers (SFRs). Additionally, it highlights the capacity of internal ROM and RAM in various 8051 models and the methods for accessing these memory types.

Uploaded by

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

Microcontroller and Embedded Systems

The document provides an overview of the memory organization of the 8051 Microcontroller, detailing its Program Memory (ROM) and Data Memory (RAM). It explains the structure and addressing of both internal and external memory, including the specific roles of Working Registers, Bit-Addressable Area, General Purpose RAM, and Special Function Registers (SFRs). Additionally, it highlights the capacity of internal ROM and RAM in various 8051 models and the methods for accessing these memory types.

Uploaded by

Sameera ambreen
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MICROCONTROLLER & EMBEDDED SYSTEMS

UNIT-1

1.3 MEMORY ORGANIZATION OF 8051

The 8051 Microcontroller Memory is divided into Program Memory


(ROM) and Data Memory (RAM).
• The Program Memory of the 8051 Microcontroller is used for storing the
program to be executed i.e. instructions.
• The Data Memory on the other hand, is used for storing temporary
variable data and intermediate results.
8051 Microcontroller has both Internal ROM and Internal RAM. If the
internal memory is inadequate, you can add external memory using
suitable circuits.

Program Memory (ROM) of 8051 Microcontroller


- In 8051 Microcontroller, the code or instructions to be executed are
stored in the Program Memory, which is also called as the ROM of the
Microcontroller.
- The original 8051 Microcontroller by Intel has 4KB of internal ROM.
Almost all modern 8051 Microcontrollers, like 8052 Series, have 8KB
of Internal Program Memory (ROM) in the form of Flash Memory
(ROM) and provide the option of reprogramming the memory.
- In case of 4KB of Internal ROM, the address space is 0000H to 0FFFH.
If the address space i.e. the program addresses exceed this value, then
the CPU will automatically fetch the code from the external Program
Memory.
- For this, the External Access Pin (EA Pin) must be pulled HIGH i.e.
when the EA Pin is high, the CPU first fetches instructions from the
Internal Program Memory in the address range of 0000H to 0FFFFH
and if the memory addresses exceed the limit, then the instructions are
fetched from the external ROM in the address range of 1000H to
FFFFH.

Process of fetching instructions both from internal and external


memories
- Another way to fetch the instructions is to ignore the Internal ROM and
fetch all the instructions only from the External Program Memory
(External ROM). For this scenario, the EA Pin must be connected to
GND. In this case, the memory addresses of the external ROM will be
from 0000H to FFFFH.
Process of fetching all the instructions from external memory
Data Memory (RAM) of 8051 Microcontroller
- The Data Memory or RAM of the 8051 Microcontroller stores
temporary data and intermediate results that are generated and used
during the normal operation of the microcontroller.
- Original Intel’s 8051 Microcontroller had 128B of internal RAM. But
almost all modern variants of 8051 Microcontroller have 256B of RAM.
- In this 256B, the first 128B i.e. memory addresses from 00H to 7FH is
divided into
• Working Registers (organized as Register Banks)
• Bit– Addressable Area
• General Purpose RAM (also known as Scratchpad area).

Working Registers:
- In the first 128B of RAM (from 00H to 7FH), the first 32B i.e. memory
from addresses 00H to 1FH consists of 32 Working Registers that are
organized as four banks with 8 Registers in each Bank.
- The 4 banks are named as Bank0, Bank1, Bank2 and Bank3. Each Bank
consists of 8 registers named as R0 – R7.
- Each Register can be addressed in two ways: either by name or by
address.
- To address the register by name, first the corresponding Bank must be
selected. In order to select the bank, we have to use the RS0 and RS1
bits of the Program Status Word (PSW) Register (RS0 and RS1 are 3rd
and 4th bits in the PSW Register).
- When addressing the Register using its address i.e. 12H for example,
the corresponding Bank may or may not be selected. (12H corresponds
to R2 in Bank2). The following addresses can be used to select register
banks.

Bit– Addressable Area:


- The next 16B of the RAM i.e. from 20H to 2FH are Bit – Addressable
memory locations.
- There are total 128 bits that can be addressed individually using 00H to
7FH or the entire byte can be addressed as 20H to 2FH.
- For example 32H is the bit 2 of the internal RAM location 26H.
General Purpose RAM:
- The final 80B of the internal RAM i.e. addresses from 30H to 7FH, is
the general purpose RAM area which are byte addressable.
- These lower 128B of RAM can be addressed directly or indirectly.
- The upper 128B of the RAM i.e. memory addresses from 80H to FFH is
allocated for Special Function Registers (SFRs).

1.4 SPECIAL FUNCTION REGISTERS (SFRs):


- A Special Function Register (or Special Purpose Register, or simply
Special Register) is a register within a microprocessor that controls or
monitors the various functions of a microprocessor.
- As the special registers are closely tied to some special function or
status of the processor, they might not be directly writable by normal
instructions (like add, move, etc.). Instead, some special registers in
some processor architectures require special instructions to modify
them.
- In the 8051, register A, B, DPTR, and PSW are a part of the group of
registers commonly referred to as SFR (special function registers). An
SFR can be accessed by its name or by its address.
- SFRs control specific functions of the 8051 Microcontroller.
- Some of the SFRs are I/O Port Registers (P0, P1, P2 and P3), PSW
(Program Status Word), A (Accumulator), IE (Interrupt Enable), PCON
(Power Control), etc.
- SRFs Memory addresses are only direct addressable.
- Even though some of the addresses between 80H and FFH are not
assigned to any SFR, they cannot be used as additional RAM area.
- In some microcontrollers, there is an additional 128B of RAM, which
share the memory address with SFRs i.e. 80H to FFH.
- But, this additional RAM block is only accessed by indirect addressing.

Prepared by
Shweta Sharma

You might also like