EcrioniX
8051 Studio v2.5 Professional
Speed: Freq:
main.asm Ready
Lines: 0 · PC: 0000H · Cycles: 0 · Time: 0.00 µs
Mode: Classic Intel 8051
[00:00:00] EcrioniX 8051 Studio ready. Write Assembly or select an experiment from the left explorer.
EcrioniX 8051 Embedded Development Board
PWR: 5.0V ON · XTAL: 12.0 MHz
Port 1 (P1) — 8× Output LEDs P1: FFH
P1.7
P1.6
P1.5
P1.4
P1.3
P1.2
P1.1
P1.0
Default: Active-High (1=ON, 0=OFF)
Port 2 (P2) — 8× DIP Input Switches P2: FFH
P2.7
P2.6
P2.5
P2.4
P2.3
P2.2
P2.1
P2.0
Click any switch to toggle input logic level (Up = 0, Down = 1).
7-Segment Display — Port 0 (P0) 00
P0.0=a, P0.1=b, P0.2=c, P0.3=d, P0.4=e, P0.5=f, P0.6=g, P0.7=dp
HD44780 16×2 Character LCD Display RS: P2.0 · RW: P2.1 · E: P2.2 · Data: P0
EcrioniX 8051Lab
Ready to run...
Writes to Port 0 strobe to LCD on E pin clock.
4×4 Matrix Keypad None
Rows: P1.0-P1.3 · Columns: P1.4-P1.7
Port 3 Push Buttons & Hardware Triggers P3: FFH
Piezo Buzzer (P3.7): SILENT
Serial UART Terminal (TxD: P3.1 / RxD: P3.0) Baud: Timer 1 (Mode 1)
UART Output Monitor
8051 UART Ready...

8051 Memory Map & Special Function Registers

128 Bytes Internal Data RAM (00H–7FH) and SFR Memory Space (80H–FFH)

Bank 0 (00H–07H)
Bank 1 (08H–0FH)
Bank 2 (10H–17H)
Bank 3 (18H–1FH)
Bit-Addressable (20H–2FH)
Scratchpad RAM (30H–7FH)
Stack Pointer (SP)

Special Function Registers (SFRs: 80H–FFH)

Program ROM Disassembly (Code Space)

Address Hex Bytes Disassembled Instruction Cycles
Assemble code to inspect ROM memory.

8051 On-Chip Timers & Interrupt Controller

Real-time hardware counter visualization and vector interrupt routing

Timer 0 (16-bit Counter) Mode 1 (16-bit)
TH0: 00H
TL0: 00H
Count: 0 / 65535
TR00
TF00
GATE0
C/T0
Timer 1 (16-bit Counter) Mode 2 (8-bit Auto-Reload)
TH1: FDH
TL1: FDH
Count: 253 / 255
TR11
TF10
GATE0
C/T0

8051 Hardware Interrupt Vector Table

Vector Interrupt Source Flag Enable Bit (IE) Priority (IP) Status
0000H Power-On Reset PIN RST Always Enabled Highest Ready
0003H External Interrupt 0 (INT0) IE0 (TCON.1) EX0 (IE.0): 0 PX0 (IP.0): 0 Idle
000BH Timer 0 Overflow (TF0) TF0 (TCON.5) ET0 (IE.1): 0 PT0 (IP.1): 0 Idle
0013H External Interrupt 1 (INT1) IE1 (TCON.3) EX1 (IE.2): 0 PX1 (IP.2): 0 Idle
001BH Timer 1 Overflow (TF1) TF1 (TCON.7) ET1 (IE.3): 0 PT1 (IP.3): 0 Idle
0023H Serial UART (RI / TI) RI/TI (SCON) ES (IE.4): 0 PS (IP.4): 0 Idle

18 Built-in 8051 Laboratory Experiments

Hands-on practical experiments covering embedded programming from basic GPIO to timers, interrupts, and UART communication.

8051 Microcontroller Architecture Masterclass

An engineering walkthrough of the Intel 8051 architecture, covering the CPU datapath, internal RAM organization, Special Function Registers, the 6 addressing modes, and machine cycle calculations.

1. The 8051 Silicon CPU Datapath

The 8051 CPU is built around an 8-bit Arithmetic Logic Unit (ALU) connected to the internal 8-bit system data bus. The ALU performs 8-bit additions, subtractions, multiplications, divisions, boolean bit manipulations, and logical operations. Operands are supplied via Accumulator A and Temporary Register 1.

  • Accumulator A (ACC): Primary working register for arithmetic, logic, and data transfers. Holds operand and result.
  • B Register: Used alongside Accumulator A during multiplication (MUL AB) and division (DIV AB). Otherwise functions as a general scratchpad register.
  • Program Status Word (PSW): 8-bit register holding status flags (CY, AC, OV, P) and register bank selection bits (RS1:RS0).
  • Program Counter (PC): 16-bit register holding the address of the next instruction to fetch from ROM. Automatically increments after each fetch.

2. Internal RAM & Register Bank Organization

The 128 bytes of internal data RAM (addresses 00H to 7FH) are divided into three physical functional partitions:

Register Banks (00H–1FH)

32 bytes divided into 4 banks (Bank 0, 1, 2, 3), each containing 8 working registers (R0–R7). Bank selection is controlled by bits RS1 (PSW.4) and RS0 (PSW.3).

Bit-Addressable RAM (20H–2FH)

16 bytes containing 128 individually addressable bit locations (bit addresses 00H through 7FH). Can be read, set, or cleared using boolean instructions like SETB 05H.

Scratchpad & Stack (30H–7FH)

80 bytes of general-purpose data memory. The 8051 stack pointer (SP) operates in this internal RAM space, pre-incrementing on PUSH and post-decrementing on POP.

8051 Instruction Set Reference & FAQs

Complete reference manual for all 111 instructions of the classic Intel 8051 microprocessor family.

Frequently Asked Questions (FAQs)

What is the 8051 microcontroller architecture? ▼

The 8051 is a Harvard-architecture 8-bit microcontroller featuring separate address and data spaces for Program Memory (ROM) and Data Memory (RAM). It has an 8-bit ALU, 128 bytes of internal RAM, 4KB on-chip ROM, four 8-bit parallel I/O ports, two 16-bit timers/counters, a full-duplex UART, and five interrupt sources.

How many register banks does the 8051 have? ▼

The 8051 has 4 register banks (Bank 0, Bank 1, Bank 2, Bank 3) located in internal RAM from address 00H to 1FH. Each bank contains 8 working registers (R0 through R7). The active register bank is selected by bits RS1 (PSW.4) and RS0 (PSW.3).

What is bit-addressable RAM in the 8051? ▼

Internal RAM addresses 20H to 2FH (16 bytes = 128 bits) are individually bit-addressable with bit addresses 00H to 7FH. In addition, Special Function Registers whose byte addresses end in 0 or 8 (such as ACC, B, PSW, P0–P3, TCON, SCON, IE, IP) are also bit-addressable.

Why does the 8051 Stack Pointer (SP) reset to 07H? ▼

Upon hardware reset, SP is loaded with 07H. Because the 8051 stack pre-increments before pushing data, the first PUSH instruction writes to address 08H (the start of Register Bank 1). To avoid corrupting Register Banks 1–3, programmers typically re-initialize SP to 30H or higher in their initialization routines.

What are the 6 addressing modes supported by the 8051? ▼

1) Immediate Addressing (e.g. MOV A, #25H), 2) Register Addressing (e.g. MOV A, R3), 3) Direct Addressing (e.g. MOV A, 30H), 4) Register Indirect Addressing (e.g. MOV A, @R0), 5) Indexed Addressing (e.g. MOVC A, @A+DPTR), and 6) Bit Addressing (e.g. SETB P1.0).

How do 8051 Timers 0 and 1 work in Mode 1 vs Mode 2? ▼

In Mode 1, the timer operates as a full 16-bit counter using both TL and TH registers (counting from 0000H to FFFFH). In Mode 2 (8-bit Auto-Reload), TL counts from its initial value up to FFH; upon overflow, it automatically reloads the value stored in TH and sets the TF overflow flag, which is commonly used to generate baud rates for the UART.

What are the 8051 interrupt sources and their vector addresses? ▼

Reset vectors to 0000H; External Interrupt 0 (INT0) vectors to 0003H; Timer 0 Overflow (TF0) vectors to 000BH; External Interrupt 1 (INT1) vectors to 0013H; Timer 1 Overflow (TF1) vectors to 001BH; Serial Communication (RI/TI) vectors to 0023H.

How does the DA A (Decimal Adjust) instruction work? ▼

DA A adjusts the 8-bit result in Accumulator A after an ADD or ADDC operation to produce two packed BCD digits. If the lower 4 bits exceed 9 or AC is set, it adds 06H. If the upper 4 bits exceed 9 or CY is set, it adds 60H and sets CY.

What is the difference between SJMP, AJMP, and LJMP? ▼

SJMP (Short Jump) is a 2-byte instruction with a relative offset between -128 and +127 bytes. AJMP (Absolute Jump) is a 2-byte instruction allowing branching within the same 2KB memory page. LJMP (Long Jump) is a 3-byte instruction with a full 16-bit address allowing branching anywhere in 64KB ROM.

How does MUL AB handle arithmetic overflow? ▼

MUL AB multiplies the unsigned 8-bit integers in A and B. The lower 8 bits of the product are placed in A, and the upper 8 bits in B. CY is always cleared. The overflow flag (OV) is set to 1 if the product exceeds 255 (i.e., if register B is non-zero); otherwise OV is cleared.

How does DIV AB handle division by zero? ▼

DIV AB divides the unsigned integer in A by B. The integer quotient is placed in A and the remainder in B. CY is always cleared. If B is zero, OV is set to 1 to indicate division-by-zero error, and the contents of A and B remain undefined.

What is the function of the DPTR (Data Pointer) register? ▼

DPTR is a 16-bit register composed of two 8-bit registers: DPH (high byte at 83H) and DPL (low byte at 82H). It is primarily used to address 64KB external RAM (via MOVX) and look up tables in Program ROM (via MOVC A, @A+DPTR).

How does the 8051 UART serial port operate in Mode 1? ▼

In Mode 1, the UART operates as a 10-bit full-duplex asynchronous serial port (1 start bit, 8 data bits, 1 stop bit). The baud rate is variable and determined by the overflow rate of Timer 1 operating in Mode 2 (8-bit auto-reload).

Can I simulate 8051 code online without installing Keil? ▼

Yes! EcrioniX 8051 Studio runs 100% in your browser. It includes a two-pass assembler, cycle-accurate instruction executor, live register inspector, memory matrix, and a virtual hardware board with LEDs, 7-segment, LCD, and UART.

Is this simulator compatible with standard 8051 assembly? ▼

Yes. It adheres strictly to the classic Intel 8051 instruction set and addressing modes, compatible with textbook examples (Mazidi, Ayala, Calcutt) and standard university lab curricula.