Skip to content
The Computer Science
TheCScience
  • Engineering Subjects
    • Human Values
    • Computer System Architecture
    • Digital Communication
    • Internet of Things
  • NCERT Solutions
    • Class 12
    • Class 11
  • HackerRank solutions
    • HackerRank Algorithms Problems Solutions
    • HackerRank C solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
The Computer Science
TheCScience

8051 Microcontroller Architecture

YASH PAL, April 12, 2026April 12, 2026

8051 Microcontroller Architecture – The microcontroller may be defined as a ‘single chip computer’ since it has all basic features of a microprocessor, like ALU, registers, flags, program counter, stack pointer, clock, and interrupt with internal ROM, RAM, parallel and serial I/O ports within the single chip. Today, many smart devices use microcontrollers to control operations as per the requirements. The read/write memory is used by a program that is run by the microcontroller to direct the hardware components to perform a desired operation. By only including the features specific to the task, the cost is relatively low. A typical microcontroller has bit manipulation instructions, easy and direct access to input/output, and quick and efficient interrupt processing. The internal organization of a microcontroller is shown in the figure below.

Internal Organization of Micrcontroller
Internal Organization of 8051 Microcontroller

Introduction to 8051

The 8051 is an 8-bit microcontroller originally designed in the 1980’s by Intel. It includes several standard peripherals like timers, counters, and UART in addition to 4KB of on-chip program memory and 128 bytes of data memory. The 8051 has a modified Harvard architecture with a separate address space for program memory and data memory. The program memory can be up to 64KB. The internal memory of the 8051 can be up to 4 KB. The 8051 memory architecture includes 128 bytes of data memory that is accessible directly by its instructions.

The 8051 instruction set is optimized for the one-bit operation so often desired in real-time control applications. The 8051 microcontroller features include a so-called ‘Boolean processor’ feature. The MSC-51 is a widely used 8-bit microcontroller which includes a whole family of microcontroller that has numbers ranging from 8031 to 8751. It is available in NMOS and CMOS construction in a variety of package types.

Architecture of 8051 Microcontroller

The 8051 microcontroller is a 40-pin DIP packaged IC that operates on a 12MHz clock frequency. 8051 has its own instruction set, which is very powerful. The figure shows the architecture of the 8051. The 8051 architecture consists of the following features.

  1. An eight-bit ALU with registers A and B and a Boolean processor.
  2. Five interrupts: 2 external and 3 internal, with two priority levels.
  3. Two 16-bit timers/counters: T0 and T1.
  4. Programmable full-duplex serial port.
  5. 32 I/O lines (four 8-bit ports).
  6. Internal RAM of 128 bytes.
  7. Internal ROM/EPROM of 4K bytes.
  8. 16 Bit program counter of 4K bytes.
  9. 16 Bit program counter and data pointer.
  10. 8 Bit program status word (PSW).
  11. 8 Bit stack pointer (SP).
  12. Oscillator and clock circuits.
Architecture of 8051 Microcontroller
Architecture of 8051 Microcontroller

Registers of 8051

The 8051 microcontroller uses various registers for various functions. The registers of the 8051 microcontroller are categorized as follows:

  1. ALU registers (Register A and Register B)
  2. Program Counter (PC) and Data Pointer (DPTR)
  3. Flags and Program Status Word (PSW)
  4. Special Function Registers (SFRs)
  5. Stack Pointer (SP)

ALU registers (Register A and Register B)

The 8051 microcontroller contains 34 general-purpose registers. Two of these, register A and register B, hold the results of many instructions. The other 32 are arranged as a part of internal RAM in four banks (B0 – B3) of eight registers each. Register A is also named the accumulator. It can hold an 8-bit value and is the most versatile register of the 8051. More than half of the 8051’s instructions manipulate or use the accumulator in some way. It is also used for all data transfer between the 8051 and any external memory. The register B also holds 8-bit data. It is only used with register A for multiplication and division operations.

Program Counter (PC) and Data Pointer (DPTR)

The 8051 contains two 16-bit registers: Program Counter (PC) and Data Pointer (DPTR). Each is used to hold the address of a byte in memory. The program counter is a 16-bit register. It is used to hold the address of the program instruction byte to be fetched from the memory. The program counter is automatically incremented after every instruction byte is fetched and may also be altered by certain instructions. PC is the only register that does not have an internal address. The address range for the different ROMs is shown in the table below.

ROMAddress Range
On-chip ROMFrom 0000H to 0FFFH
Additional external ROMExceeding 0FFFH to FFFFH
Total external ROMFrom 0000H to FFFFH
Address range for different ROMs

The data pointer (DPTR) register is made up of two 8-bit registers: DPH and DPL. It is used to provide a memory address for (i) internal and external code access and (ii) external data access. The DPTR is under the control of program instructions and can be specified by its 16-bit name, DPTR, or by each individual byte name, DPH and DPL. DPTR does not have a single internal address; DPH and DPL are each assigned an address.

Flags and Program Status Word (PSW)

The program status word is used to store a number of important bits that are set and reset by 8051 instructions. The program status word contains the carry flag, the auxiliary flag, the overflow flag, and the parity flag. These flags have similar functions as in 8085 or 8086 microprocessors. The 8051 microcontroller provides the same general-purpose flags, named F0, GFO, and GF1. These flags may be used by the programmer to record some event in the program. The program status word, as shown in the table below, contains all math flags (Carry, auxiliary carry, overflow, and parity flags), F0 user flag, and register select bits (RS1 and RS0) that identify the register bank currently in use.

76543210
CYACF0RS1RS00V–P
PSW

The program status word (PSW) Special Function Register

BitSymbolFunction
7CYCarry flag; used in arithmetic, jump, rotate, and Boolean instructions
6ACAuxiliary Carry flag; used for BCD arithmetic
5F0User flag 0
4RS1Register bank select bit 1
3RS0Register bank select bit 0
RS1 RS0
0 0 Select register bank 0
0 1 Select register bank 1
1 0 Select register bank 2
1 1 Select register bank 3
20VOverflow flag; used in arithmetic instructions
1–Reserved for future use
0PParity flag; shows parity of register A:1 = Odd Parity Bit addressable as PSW.0 to PSW.7
Program Status Word (PSW)

Note – Two user flags, GF0 and FGI, are not included in PSW but are stored in the power control (PCON) register.

Special Function Registers (SFRs)

Special function registers are used for specific functions and have their symbolic names. These SFRs may be addressed using the internal address (similar to RAM0 range from 80H to FFH, except the program counter. Some special function registers are bit-addressable. This feature allows the programmer to change only the bit neends to be changed, leaving the remaining bits in that SFR unchanged. The special function registers, names, functions, and equivalent internal RAM addresses are given in the table below.

NameFunctionInternal RAM Address (HEX)
AAccumulator0E0
BArithmetic0F0
DPHAddressing external memory83
DPLAddressing external memory82
IEInterrupt enable control0A8
IPInterrupt priority0BB
P0Input/output port latch80
P1Input/output port latch90
P2Input/output port latch0A0
P3Input/output port latch0B0
PC0NPower control87
PWNProgram status word0D0
SC0NSerial port control98
SBUFSerial port data buffer99
SPStack pointer81
TM0DTimer/counter mode control89
TC0NTimer/counter control88
TL0Timer 0 low byte8A
TH0Timer 0 high byte8C
TL1Timer 1 low byte8B
TH1Timer 1 high byte8D
Special Function Registers and their addresses

Stack Pointer (SP)

A stack is defined as an area of internal RAM that is used to store and retrieve data during the execution of the program. The address of internal RAM can be given by an 8-bit address. The stack pointer is an 8-bit register. It stores the top of the stack address, which is an 8-bit address. The 8051 microcontroller pushes and pops the 8-bit data instead of 16-bit data, as in the 8085 microprocessor. The stack operation is shown in the figure below.

Stack operation of 8051 microcontroller
Stack operation of the 8051 microcontroller
engineering subjects Microprocessor microprocessor

Post navigation

Previous post
Next post

Select your Subject

TheCScience

We at TheCScience.com are working towards the goal to give free education to every person by publishing in dept article about Secondary, Senior-Secondary, and Graduation level subjects.

Pages

About US

Contact US

Privacy Policy

DMCA

Our Tools

Hosting - get 20% off

Engineering Subjects

Internet of Things

Human Values

Digital Communication

Computer System Architecture

Programming Tutorials

Data Structure and Algorithm

C

Java

NCERT

Class 12th

©2026 TheCScience | WordPress Theme by SuperbThemes