8051 Virtual Lab

Multiplexed 4-Digit 7-Segment Display (Assembly Concept)

🧪 Experiment Overview

This experiment demonstrates multiplexing of a 4-digit 7-segment display using an 8051 microcontroller. Only one digit is enabled at a time, but rapid refreshing creates the illusion that all digits are ON simultaneously.

; SEGMENTS -> P1
; DIGIT SELECT -> P2.0 - P2.3

ORG 0000H
MOV DPTR,#TABLE

MAIN:
MOV R0,#00H

REFRESH:
MOV A,R0
MOVC A,@A+DPTR
MOV P1,A

MOV P2,#01H      ; Digit 1
ACALL DELAY
MOV P2,#02H      ; Digit 2
ACALL DELAY
MOV P2,#04H      ; Digit 3
ACALL DELAY
MOV P2,#08H      ; Digit 4
ACALL DELAY

INC R0
CJNE R0,#04,REFRESH
MOV R0,#00H
SJMP REFRESH

TABLE:
DB 3FH,06H,5BH,4FH
END
Active Digit: 1
P1 = 00000000
P2 = 00000001
Segments → P1 (a–g)
Digit Select → P2.0–P2.3