Memory Structures - Data and Program Memory
Learning Goals
- Understand the complete memory organization of the 8051 with separate data and program memory spaces (Harvard architecture)
- Describe the data memory (internal RAM) organization: register banks (00H-1FH), general-purpose RAM (20H-7FH), and SFR space (80H-FFH)
- Explain the concept of memory banks and how they are selected through register bits in PSW
- Identify the bit-addressable area in RAM: specifically the 16 bytes from 20H to 2FH that support bit-level operations
- Analyze the structure and function of each register bank (4 banks × 8 registers)
- Understand program memory (ROM) capacity in standard 8051 (4KB) and how it's addressed by the 16-bit PC
- Distinguish between byte addressing (for data memory) and bit addressing (for specific RAM locations)
- Explain how bit addressing is implemented in the instruction set for bitwise operations on bit-addressable locations
In the 8051 microcontroller, memory organization is fundamental to understanding how instructions execute and how data is stored. The 8051 uses a Harvard architecture, meaning program memory and data memory are treated as separate logical spaces rather than one shared memory map.2 This separation allows the CPU to fetch instructions from code memory while independently operating on data memory, which is one reason the 8051 became highly effective for embedded control applications.2
For the standard 8051, the key memory facts are:
- Program memory (code memory): 4 KB on-chip ROM, occupying addresses 0000H–0FFFH when internal code memory is enabled.2
- Program Counter (PC): 16-bit, so the CPU can address up to 64 KB of code space in total.2
- Internal data memory (RAM): 128 bytes, mapped from 00H–7FH in the original 8051.2
- The internal RAM is divided into:
- Register banks: 00H–1FH
- Bit-addressable RAM: 20H–2FH
- General-purpose RAM: 30H–7FH2
- Special Function Registers (SFRs): 80H–FFH, used to control CPU, ports, timers, serial interface, interrupts, and status flags.2
A useful way to think about the 8051 is that it has two major memory worlds:
This topic is especially important in 8051 programming because many instructions depend directly on whether an operand is in register space, direct RAM, bit-addressable RAM, or SFR space.2
Footnotes
-
MICROCONTROLLERS LEARNING OBJECTIVES - Describes Harvard architecture and identifies the 8051 as using separate program and data memories. ↩
-
ARCHITECTURE OF 8031/8051 MICROCONTROLLER - Explains internal 4 KB ROM, 16-bit PC, EA behavior, and external code memory access. ↩ ↩2 ↩3 ↩4
-
8051 Memory Organization - Annamalai University - Summarizes program memory and data memory separation in the 8051. ↩
-
Block Diagram of 8051 Microcontroller - States that internal ROM occupies code memory 0000H-0FFFH in the standard 8051. ↩
-
8051 Hardware Overview - Documents 16-bit PC, EA, PSEN, and the 64 KB code-space map. ↩
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2 ↩3
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩ ↩2 ↩3
-
C51 Family - Keil - Provides architectural discussion of internal RAM, upper regions, and SFR behavior. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
Memory organization of 8051 | Data memory organization of 8051 microcontroller
Core Idea
The 8051 does not treat program memory and data memory as one combined address map. Code bytes are fetched from program memory, while variables and registers are accessed in data memory.2
Footnotes
-
MICROCONTROLLERS LEARNING OBJECTIVES - Describes Harvard architecture and identifies the 8051 as using separate program and data memories. ↩
-
ARCHITECTURE OF 8031/8051 MICROCONTROLLER - Explains internal 4 KB ROM, 16-bit PC, EA behavior, and external code memory access. ↩
1. Harvard Architecture in the 8051
The 8051 follows the Harvard model, where code memory and data memory are distinct spaces.2 Even if both spaces conceptually contain addresses like 0000H, those addresses belong to different memory domains. Thus:
0000Hin program memory refers to the start of the instruction space.00Hin data memory refers to the first byte of internal RAM.
This distinction is visible in the instruction set:
- Instructions such as MOV operate on internal data memory or SFRs.
- Instructions such as MOVC access code memory.
- Instructions such as MOVX access external data memory.
Because the spaces are separate, the same numeric address does not imply the same physical meaning across program and data memory.2
This architecture also explains why the 8051 has specialized instructions for different memory spaces rather than a single uniform load/store scheme.2
Footnotes
-
MICROCONTROLLERS LEARNING OBJECTIVES - Describes Harvard architecture and identifies the 8051 as using separate program and data memories. ↩
-
ARCHITECTURE OF 8031/8051 MICROCONTROLLER - Explains internal 4 KB ROM, 16-bit PC, EA behavior, and external code memory access. ↩ ↩2 ↩3
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩ ↩2 ↩3
-
Section 1 8051 Microcontroller Instruction Set - Microchip Technology - Lists Boolean manipulation, stack behavior, and memory-access instructions such as MOV, MOVX, and bit instructions. ↩ ↩2 ↩3
How the 8051 Data Memory Is Organized
- 1Step 1
In the original 8051, internal data RAM occupies addresses
00Hto7FH, giving a total of 128 bytes.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩
-
- 2Step 2
Addresses
00Hto1FHare divided into four register banks, each containing eight registers namedR0toR7.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩
-
- 3Step 3
Addresses
20Hto2FHform a 16-byte area whose 128 individual bits can each be addressed directly by bit-oriented instructions.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
- 4Step 4
Addresses
30Hto7FHare used as ordinary byte-addressable RAM for variables, temporary storage, and often the stack.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩
-
- 5Step 5
Addresses
80HtoFFHare assigned to Special Function Registers, which control peripherals and core functions such asACC,B,PSW,SP,DPTR, I/O ports, timers, interrupt control, and serial communication.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
C51 Family - Keil - Provides architectural discussion of internal RAM, upper regions, and SFR behavior. ↩
-
2. Internal Data Memory Map
The internal data memory structure of the standard 8051 can be summarized as follows:3
Two important clarifications are necessary:
- In the original 8051, the main internal RAM universally discussed for programming is the lower 128 bytes (00H–7FH).2
- The SFR space (80H–FFH) is not ordinary RAM; it contains control registers for hardware functions.2
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2 ↩3
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩ ↩2
-
C51 Family - Keil - Provides architectural discussion of internal RAM, upper regions, and SFR behavior. ↩ ↩2
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
Common Confusion
Addresses 80H to FFH are not general-purpose RAM in the standard 8051. They represent Special Function Registers, and these are primarily accessed by direct addressing instructions.2
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
3. Register Banks: 00H–1FH
The first 32 bytes of internal RAM are organized as four register banks, and each bank contains eight 8-bit registers named R0 through R7.2
| Bank | Address Range | Registers |
|---|---|---|
| Bank 0 | 00H–07H | R0–R7 |
| Bank 1 | 08H–0FH | R0–R7 |
| Bank 2 | 10H–17H | R0–R7 |
| Bank 3 | 18H–1FH | R0–R7 |
Only one bank is active at a time for instructions that refer to registers by name, such as MOV A, R3.2 Which bank is active depends on the RS1 and RS0 bits in the PSW (Program Status Word).2
The bank selection table is:
| RS1 | RS0 | Active Bank | RAM Addresses |
|---|---|---|---|
| 0 | 0 | Bank 0 | 00H–07H |
| 0 | 1 | Bank 1 | 08H–0FH |
| 1 | 0 | Bank 2 | 10H–17H |
| 1 | 1 | Bank 3 | 18H–1FH |
By default after reset, Bank 0 is typically selected because PSW starts cleared in the standard architecture.2
This banked structure is useful because register instructions are compact and efficient, and bank switching can reduce context-saving overhead in interrupt-driven systems.2
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2 ↩3
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩ ↩2 ↩3
-
C51 Family - Keil - Provides architectural discussion of internal RAM, upper regions, and SFR behavior. ↩
-
THE 8051 INSTRUCTION SET - Includes standard SFR reset values such as PSW and SP relevant to bank selection and stack behavior. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
Understanding Register Banks and PSW Selection
4. Structure and Function of Each Register Bank
Each bank contains the same logical register names:
R0R1R2R3R4R5R6R72
But their physical addresses differ by bank:
| Logical Register | Bank 0 | Bank 1 | Bank 2 | Bank 3 |
|---|---|---|---|---|
| R0 | 00H | 08H | 10H | 18H |
| R1 | 01H | 09H | 11H | 19H |
| R2 | 02H | 0AH | 12H | 1AH |
| R3 | 03H | 0BH | 13H | 1BH |
| R4 | 04H | 0CH | 14H | 1CH |
| R5 | 05H | 0DH | 15H | 1DH |
| R6 | 06H | 0EH | 16H | 1EH |
| R7 | 07H | 0FH | 17H | 1FH |
A crucial programming implication is this:
MOV A, R2uses the currently selected bank.MOV A, 12Haccesses the RAM byte at address12Hdirectly, which corresponds physically toR2of Bank 2 whether or not Bank 2 is currently selected.2
This is the difference between register addressing by name and direct byte addressing by address.
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2 ↩3
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩ ↩2
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
How Register Bank Selection Works Through PSW
- 1Step 1
The Program Status Word is an SFR that contains status flags and the register bank select bits
RS1andRS0.Footnotes
-
C51 Family - Keil - Provides architectural discussion of internal RAM, upper regions, and SFR behavior. ↩
-
- 2Step 2
These two bits determine which bank becomes active for register names
R0throughR7.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩
-
- 3Step 3
The combinations
00,01,10, and11select Bank 0, Bank 1, Bank 2, and Bank 3 respectively.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩
-
- 4Step 4
Instructions like
MOV A,R5,ADD A,R2, orMOV R1,#datanow operate on the selected bank only.Footnotes
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
- 5Step 5
If a programmer wants a specific physical RAM location regardless of bank selection, direct addressing such as
MOV A,15His used instead of symbolicR5.2Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
1; Select register bank 2 2CLR PSW.3 ; RS0 = 0 3SETB PSW.4 ; RS1 = 1 4 5; Now R0-R7 refer to addresses 10H-17H 6MOV A, R0 ; A <- RAM[10H] 7MOV R7, #55H ; RAM[17H] <- 55H
5. Bit-Addressable RAM: 20H–2FH
One of the most distinctive features of the 8051 is its support for bit-level processing. The 16 bytes from 20H to 2FH are special because each bit inside these bytes can be addressed individually.3
This means:
- As bytes, the region spans 16 bytes.
- As bits, it provides 128 directly addressable bits.2
- Bit addresses range from 00H to 7FH.2
So the area is both:
- byte-addressable as locations
20Hto2FH, and - bit-addressable as individual bit addresses
00Hto7FH.2
For example:
- Byte address
20Hcontains 8 bits with bit addresses00Hto07H. - Byte address
21Hcontains bit addresses08Hto0FH. - ...
- Byte address
2FHcontains bit addresses78Hto7FH.
A useful mapping rule is:
where bit position ranges from 0 to 7.2
For instance, the bit address for bit 2 of byte 26H is:
So bit 2 of RAM byte 26H corresponds to bit address 32H.
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩ ↩2 ↩3 ↩4 ↩5
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
6. Byte Addressing vs Bit Addressing
The 8051 supports two important ways of referring to data locations:
Byte Addressing
A full 8-bit memory location is accessed at once.
Examples:
MOV A, 30HMOV 2AH, #55H
Here the operand refers to an entire byte.
Bit Addressing
A single bit is accessed directly.2
Examples:
SETB 25HCLR 32HJB 12H, LABEL
Here the operand refers to an individual bit in either:
- the bit-addressable RAM area (
00H–7FHas bit addresses), or - bit-addressable SFR bits (
80H–FFHwhere supported).2
This distinction is crucial because bit addressing enables highly efficient Boolean control logic without read-modify-write software sequences typical of many other architectures.
Footnotes
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩ ↩2 ↩3 ↩4
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩ ↩2 ↩3
Why Bit Addressing Matters
Bit-addressable RAM is extremely useful for flags, status indicators, control signals, and finite-state logic. Instead of masking a byte manually, the 8051 can set, clear, test, or branch on one bit directly.2
Footnotes
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
How Bit Addressing Is Implemented in the 8051 Instruction Set
- 1Step 1
The target must be either one of the 128 bits in RAM bytes
20Hto2FH, or a bit-addressable SFR bit in the SFR region.2Footnotes
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
-
- 2Step 2
Bit operations in the 8051 use direct bit addresses rather than register-indirect addressing.2
Footnotes
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
-
- 3Step 3
The instruction set provides dedicated bit operations such as
SETB bit,CLR bit,CPL bit,MOV C,bit,MOV bit,C,ANL C,bit,ORL C,bit, and conditional branches likeJB,JNB, andJBC.3Footnotes
-
Section 1 8051 Microcontroller Instruction Set - Microchip Technology - Lists Boolean manipulation, stack behavior, and memory-access instructions such as MOV, MOVX, and bit instructions. ↩
-
C51 Family - Keil - Describes lower 128-byte RAM use, direct/indirect access, and bit-oriented instruction capabilities. ↩
-
Section 1 8051 Microcontroller Instruction Set - Microchip Technology - Provides opcode-level descriptions of SETB, CLR, CPL, JB, JNB, JBC, ANL, ORL, and MOV involving bit operands. ↩
-
- 4Step 4
Because the architecture supports one-bit operands natively, individual flags can be tested or modified without loading and masking a whole byte first.2
Footnotes
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
-
- 5Step 5
Instructions such as
JBandJNBdirectly connect bit state to branching logic, making the 8051 especially strong in control-oriented applications.2Footnotes
-
C51 Family - Keil - Describes lower 128-byte RAM use, direct/indirect access, and bit-oriented instruction capabilities. ↩
-
Section 1 8051 Microcontroller Instruction Set - Microchip Technology - Provides opcode-level descriptions of SETB, CLR, CPL, JB, JNB, JBC, ANL, ORL, and MOV involving bit operands. ↩
-
1SETB 20H ; Set bit address 20H 2CLR 20H ; Clear bit address 20H 3CPL 20H ; Complement bit address 20H 4MOV C,20H ; Copy bit into carry 5MOV 21H,C ; Copy carry into bit
7. General-Purpose RAM: 30H–7FH
After the register-bank area and bit-addressable section, the remaining 80 bytes from 30H to 7FH are available as general-purpose internal RAM.2 This region is commonly used for:
- local variables,
- counters,
- buffers,
- temporary arithmetic storage,
- stack usage depending on program design.2
Unlike the 20H–2FH region, this area is byte-addressable only; its bits are not individually addressable through the bit instruction set.2
Another important practical detail is that the stack also resides in internal RAM unless carefully managed otherwise. Since the Stack Pointer (SP) defaults to 07H after reset, the stack initially grows from 08H upward, which can overlap with register-bank space unless the programmer relocates it.2
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩ ↩2
-
Section 1 8051 Microcontroller Instruction Set - Microchip Technology - Lists Boolean manipulation, stack behavior, and memory-access instructions such as MOV, MOVX, and bit instructions. ↩ ↩2
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
C51 Family - Keil - Describes lower 128-byte RAM use, direct/indirect access, and bit-oriented instruction capabilities. ↩
Stack Placement Caution
Because the stack grows upward in internal RAM and the default SP value is 07H, careless stack use may interfere with register banks or low RAM locations. Many programs move the stack into higher RAM such as the 30H-7FH region.2
Footnotes
-
Section 1 8051 Microcontroller Instruction Set - Microchip Technology - Lists Boolean manipulation, stack behavior, and memory-access instructions such as MOV, MOVX, and bit instructions. ↩
-
C51 Family - Keil - Describes lower 128-byte RAM use, direct/indirect access, and bit-oriented instruction capabilities. ↩
8. Special Function Register Space: 80H–FFH
The address range 80H–FFH is reserved for Special Function Registers (SFRs).2 These are control and status registers associated with CPU operation and on-chip peripherals.
Typical SFRs include:2
| SFR | Address | Function |
|---|---|---|
| P0 | 80H | Port 0 latch |
| SP | 81H | Stack Pointer |
| DPL | 82H | Data Pointer low byte |
| DPH | 83H | Data Pointer high byte |
| PCON | 87H | Power control |
| TCON | 88H | Timer control |
| TMOD | 89H | Timer mode |
| P1 | 90H | Port 1 latch |
| SCON | 98H | Serial control |
| SBUF | 99H | Serial data buffer |
| P2 | A0H | Port 2 latch |
| IE | A8H | Interrupt enable |
| P3 | B0H | Port 3 latch |
| IP | B8H | Interrupt priority |
| PSW | D0H | Program Status Word |
| ACC | E0H | Accumulator |
| B | F0H | B register |
Not all addresses between 80H and FFH are necessarily implemented in every device, but the standard SFR locations are architecturally defined.2
Some SFRs are also bit-addressable, particularly those whose addresses end in 0H or 8H in the standard map, such as P0, TCON, P1, SCON, P2, IE, P3, IP, PSW, ACC, and B.
Footnotes
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2
-
C51 Family - Keil - Provides architectural discussion of internal RAM, upper regions, and SFR behavior. ↩ ↩2 ↩3
-
C51 Family - Keil - Describes lower 128-byte RAM use, direct/indirect access, and bit-oriented instruction capabilities. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
9. Program Memory in the Standard 8051
The standard 8051 includes 4 KB of on-chip program memory, usually occupying addresses 0000H through 0FFFH in code space.2 Because the Program Counter is 16 bits, the processor can address a total of 64 KB of program memory, from 0000H to FFFFH.2
This leads to an important distinction:
- On-chip code memory available in standard 8051: 4 KB2
- Maximum code address space the CPU can address: 64 KB2
If the EA (External Access) pin is held high, the 8051 uses internal ROM for the lower 4 KB and external code memory for addresses beyond 0FFFH if needed.3 If EA is held low, the processor ignores internal ROM and fetches all code from external program memory.2
The signal PSEN is used during reading of external program memory.2
Footnotes
-
ARCHITECTURE OF 8031/8051 MICROCONTROLLER - Explains internal 4 KB ROM, 16-bit PC, EA behavior, and external code memory access. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7
-
Block Diagram of 8051 Microcontroller - States that internal ROM occupies code memory 0000H-0FFFH in the standard 8051. ↩ ↩2 ↩3
-
8051 Hardware Overview - Documents 16-bit PC, EA, PSEN, and the 64 KB code-space map. ↩ ↩2 ↩3 ↩4 ↩5
Standard 8051 Memory Capacity Overview
Comparison of key built-in memory regions in the classic 8051
10. How the 16-bit Program Counter Addresses Program Memory
The Program Counter (PC) is a 16-bit register that holds the address of the next instruction byte to be fetched.2 Because 16 bits can represent:
the PC can address:
of code space.2
In normal execution:
- the PC points to the next code byte,
- the CPU fetches the instruction byte from program memory,
- the PC increments automatically after fetch,
- branch and call instructions load the PC with a new address.2
Thus, while the standard chip contains only 4 KB internal ROM, the architecture itself supports a 64 KB code-space model.2
Footnotes
-
ARCHITECTURE OF 8031/8051 MICROCONTROLLER - Explains internal 4 KB ROM, 16-bit PC, EA behavior, and external code memory access. ↩ ↩2 ↩3 ↩4
-
8051 Hardware Overview - Documents 16-bit PC, EA, PSEN, and the 64 KB code-space map. ↩ ↩2 ↩3 ↩4
Program Memory Clarifications
11. Integrated Concept Map
The 8051 memory system can be viewed as a layered structure:
This model ties together the course learning goals:
- separate program and data memory spaces,2
- internal RAM divided into register banks, bit-addressable RAM, and general-purpose RAM,2
- PSW-based bank selection,
- bit-level instructions on selected memory regions,2
- and 4 KB standard program ROM addressed within a 16-bit code space.3
Footnotes
-
MICROCONTROLLERS LEARNING OBJECTIVES - Describes Harvard architecture and identifies the 8051 as using separate program and data memories. ↩
-
ARCHITECTURE OF 8031/8051 MICROCONTROLLER - Explains internal 4 KB ROM, 16-bit PC, EA behavior, and external code memory access. ↩ ↩2
-
TOPIC NAME-8051 Microcontroller Memory Organization - Details internal RAM layout, register banks, bit-addressable area, and SFR region. ↩ ↩2
-
Internal RAM organization of 8051 - Gives address ranges for register banks, bit-addressable RAM, and general-purpose RAM. ↩
-
80C51 family architecture - PJRC - Explains direct and indirect addressing, register-bank selection, and direct bit operations in RAM and SFR space. ↩
-
8051 Instruction Set - Silicon Labs - Highlights Boolean variable operations and confirms bit-addressable memory from 20H to 2FH. ↩
-
Block Diagram of 8051 Microcontroller - States that internal ROM occupies code memory 0000H-0FFFH in the standard 8051. ↩
-
8051 Hardware Overview - Documents 16-bit PC, EA, PSEN, and the 64 KB code-space map. ↩
Knowledge Check
Which address range in the standard 8051 internal RAM is reserved for the four register banks?