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 8051 MicrocontrollerIntroduction to 8051The 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 MicrocontrollerThe 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.An eight-bit ALU with registers A and B and a Boolean processor.Five interrupts: 2 external and 3 internal, with two priority levels.Two 16-bit timers/counters: T0 and T1.Programmable full-duplex serial port.32 I/O lines (four 8-bit ports).Internal RAM of 128 bytes.Internal ROM/EPROM of 4K bytes.16 Bit program counter of 4K bytes.16 Bit program counter and data pointer.8 Bit program status word (PSW).8 Bit stack pointer (SP).Oscillator and clock circuits.Architecture of 8051 MicrocontrollerRegisters of 8051The 8051 microcontroller uses various registers for various functions. The registers of the 8051 microcontroller are categorized as follows:ALU registers (Register A and Register B)Program Counter (PC) and Data Pointer (DPTR)Flags and Program Status Word (PSW)Special Function Registers (SFRs)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 RangeOn-chip ROMFrom 0000H to 0FFFHAdditional external ROMExceeding 0FFFH to FFFFHTotal external ROMFrom 0000H to FFFFHAddress range for different ROMsThe 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.76543210CYACF0RS1RS00V–PPSWThe program status word (PSW) Special Function RegisterBitSymbolFunction7CYCarry flag; used in arithmetic, jump, rotate, and Boolean instructions6ACAuxiliary Carry flag; used for BCD arithmetic5F0User flag 04RS1Register bank select bit 13RS0Register bank select bit 0RS1 RS00 0 Select register bank 00 1 Select register bank 11 0 Select register bank 21 1 Select register bank 320VOverflow flag; used in arithmetic instructions1–Reserved for future use0PParity flag; shows parity of register A:1 = Odd Parity Bit addressable as PSW.0 to PSW.7Program 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)AAccumulator0E0BArithmetic0F0DPHAddressing external memory83DPLAddressing external memory82IEInterrupt enable control0A8IPInterrupt priority0BBP0Input/output port latch80P1Input/output port latch90P2Input/output port latch0A0P3Input/output port latch0B0PC0NPower control87PWNProgram status word0D0SC0NSerial port control98SBUFSerial port data buffer99SPStack pointer81TM0DTimer/counter mode control89TC0NTimer/counter control88TL0Timer 0 low byte8ATH0Timer 0 high byte8CTL1Timer 1 low byte8BTH1Timer 1 high byte8DSpecial Function Registers and their addressesStack 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 the 8051 microcontroller engineering subjects Microprocessor microprocessor