0% found this document useful (0 votes)
147 views5 pages

2 - Interfacing of Led

This document provides an assembly language program to interface an LED to an 8051 microcontroller and toggle the LED on and off. It describes two methods to connect an LED and explains the necessary resistor. The program initializes registers, sets the data pointer to toggle the LED pin, and uses delays to blink the LED.

Uploaded by

30. Padmaja .L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
147 views5 pages

2 - Interfacing of Led

This document provides an assembly language program to interface an LED to an 8051 microcontroller and toggle the LED on and off. It describes two methods to connect an LED and explains the necessary resistor. The program initializes registers, sets the data pointer to toggle the LED pin, and uses delays to blink the LED.

Uploaded by

30. Padmaja .L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

WITH

8051
LED
INTERFACING

EX.NO: 4a

DATE:
toone of the
AIM
to for toggling
the LED
connected
port pins oft
port n:

program
Write an assembly language
8051

THEORY:
device) and Software (source co.
dde
comprises of hardware (Interface
mtertacing
use an LED as the output device, LED should h.
communicate, also called as the Driver). Simply, to
inside make LED ON or OFF
connected to Microcontroller port and the MC has to be programmed .

driver software can be developed usino


blink or dim. This program is called as the driver/firmware. The
any programming language like Assembly, C etc.

There are two ways which we can interface LED to the Microcontroller 8051. But the
connections and programming techniques will be different. This article provides the information on
LED interfacing with 8051 and LED blinking code for AT89C52/ AT89CSI Microcontroller.

Observe carefully the interface LED 2 is in forward biased because the input voltage of Sv connected to
the positive terminal of the LED, So here the Microcontroller pin should be at LOW level and vice
versa with the interface 1 connections.

The resistor is important in LED interfacing to limit the


flowing current and avoid damaging the LED
and/or MCU.

Interface l will glow LED, only if the PIN value of the MC is


HIGH as current flows towardsthe
ground.

Interface 2 will glow LED, only if the PIN value of the


MC is LOW as current flows
due to its lower potential. towardsPINN

Page 30 of 105
InputVoltage
8051 Resistor
8051
port pin
Resistor port pin

EDNTERFACE 2
LED NTERFACE 1

Interfacing LED to 8051 Methods

PROGRAM:

4loo START
DPTR, t412B
90 41 28 MOV
100
AR HOV R2, DPL

4L06 AD 63 HOV R3, DPH

H104
13 04 HOV Ro, #O1

RA, +CB
4109

4LOB
L
HIOB E% A, RO
C HV
LOC 9D FF HV DPTR # FFCO

HIOF FO Holr DPTR, A


3A 32 Hov DPL, Ra

HOV DPH, R2
Page 31 of 105
HOVx DPTR A
IS 90 FF c HOV DPTR, 4 FFc
PO OVX DOTR, A
2 L CALL H122
OA INC R2
DEC RO

DF EB DJNL RI, tl0s

21
AJHP Hr0O
4122
DELAY:
122
HI24 MOV R4 to2
L
124 1D FF OV R5, # FF
SCHEMATIC DIAGRAM:
412 L2
DD DJNZ RS, H/2
123 De FA DJNZ Ry, 4/24
U1
12A ReT
22 19XTAL1 PO0/ADO
PO.1/AD1
PO.2/AD2
18XTAL2 PO.3/AD3
PO.4/AD4
P0.5/AD5-4
PO.6/ADS
RST PO.7/AD7
R1
D1
P2.0/AB 21
P2.1/A9 22 331
P2.2/A10 LED-BIBY
PSEN
30 P2.3/A11 TEXT>
P2.4/A12
P2.5/A13
P2.6/A14
P2.7/A15H& 2
P3.0/RXD
P3.1/TXD
P3.2/INTO
P3.3/INT1
1 P3.4/T0
P1
P1 6
P3.5/T1
P3.6/WR
P3.7/RD
ATE9C51
<TERT

TACLE
H120
OD SS 3E, 0L) oo , SS
12F SD 3F DB
HI 3 Lab Questions:
END
DJNZ RH
U1 RET
PO0ADO
1XTAL1 PO 1/A01
P0.2/AUZ
PO3/AD3
XTAL2 PG.4/AD4
34
PO.5/ADS
PO6/ADE5 2 D1
PO.7/AD7 R1
RST 21
P20/A8 2 331
P21/A9 LED-BBY
P2 2/A10
P2.3/A11
22 PSEN P2 4/A12
P25/A13 27
P2.6/A14
P2.7/A15
P3.0/RXD
10
P1.0
P1.1 P3 1/TXD
1
P1.2 P3.2/NTOD 12
A P13 P3.3/ANTT
P3.4/10
14
P14
P15 P3.5/T1 15
7 P16 P3.6WR
P17 P3.7/RD
AT89C51
Lrtulaung eED wiih os
o

etant

Ynt iadge T tord olln

Hos T
Cowte Roat
Ouellou Coute to O

NO

Tha
Buttpn numert
Pesoe? Tho Colln

NO

Rap Doi Col Sunchon wn


to
tb 7 eegmt olap

You might also like