8051
8051
Talchhikhel, Lalitpur
A LAB REPORT ON
8051 MICROCONTROLLER
Objectives:
Theory
The 8051 microcontroller is an 8-bit microcontroller developed by Intel in 1980, widely used in
embedded systems due to its simplicity and efficiency. It features 4KB of ROM, 128 bytes of RAM, 32
general-purpose I/O pins, two timers/counters, and a serial communication interface. With its Harvard
architecture, it can process instructions and data separately, enhancing performance. The 8051 also
supports interrupt handling, making it suitable for real-time applications. Due to its low power
consumption, ease of programming, and versatility, it is commonly used in automation, robotics,
industrial control systems, and consumer electronics.
CODE:
ORG 00H
CLR P2.3
BACK:
CLR P2.3
LCALL DELAY
SETB P2.3
LCALL DELAY
SJMP BACK
ORG 300H
DELAY:
MOV R5, #64H
AGAIN:
AGAN:
AGA:
RET
END
OUTPUT:
2. WAP to generate a 0-9 counter using a 7-segment
display.
CODE:
ORG 00H
CLR P1.1
SETB P2.1
SETB P2.2
FAST: MOV C, P2.1
JNC SLOW
SETB P1.1
LCALL DELAY
CLR P1.1
LCALL DELAY
SLOW: MOV C, P2.2
JNC FAST
SETB P1.1
LCALL DELAY
LCALL DELAY
CLR P1.1
LCALL DELAY
LCALL DELAY
SJMP FAST
ORG 300H
DELAY: MOV R5, #64H
AGAIN: MOV R4, #0FFH
AGAN: MOV R3, #08H
AGA: DJNZ R3, AGA
DJNZ R4, AGAN
DJNZ R5, AGAIN
RET
END