You are on page 1of 8

7-segment LED

displays

A seven segment LED consist of seven light emitting


diode segments and one segment for the decimal point.
The segments are physically arranged in the form of 8.
To display a number , or a letter from A to F the necessary
segments are lit by sending an appropriate signal for
current flow through the diodes.
An LED will be illuminated if it is forward-biased and
there is enough current flowing through it. Typically, a
current of few milliamps up to 20mA is required.
The voltage drop across a forward-biased LED ranges
from about 1.6V to 2.5V.

ECP2036 Microprocessor and Interfacing

ECP2036 Microprocessor and Interfacing

The binary code required to to display a digit is determined


by the type of LED configuration ( common anode or
common cathode)
For common anode configuration a logic 0 is required to
turn on a segment. For common cathode type a logic 1 is
required.
With displays having many display elements, rather than
having to use a decoder for each element, multiplexing is
used with a single decoder.
To maintain a constant display, a display is repeatedly
turned on sufficiently often for the display to appear
flicker-free.

ECP2036 Microprocessor and Interfacing

Interfacing to 7-segment LED displays


a
f

h g

0 == ON

Common Cathode

1 == ON

Common Anode

Examples:
b

10000110 (CA)

01111001 (CC)

ECP2036 Microprocessor and Interfacing

Interfacing to Two 7-segment LED


VCC

8051

VCC

Tr1

Tr2

a
b
c
d
e
f
g
h

a
b
c
d
e
f
g
h

74LS07
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7

LED 1

LED 2

P3.0
P3.1
P3.2
P3.3
P3.4
P3.5
P3.6
P3.7

ECP2036 Microprocessor and Interfacing

Sample Program to display HI


CHAR_H EQU
CHAR_I EQU
;
BEGIN: CLR
MOV
SETB
CALL
;
CLR
MOV
SETB
CALL
;
SJMP
;
DELAY_25:
..
;
END

89H
0F9H
P3.5
P1,#CHAR_H
P3.4
DELAY_25

; turn off LED2


; display H on LED1

P3.4
P1,#CHAR_I
P3.5
DELAY_25

; turn off LED1


; display I on LED2

BEGIN

; repeat displays

; delay for 25 ms

; delay for 25 ms

ECP2036 Microprocessor and Interfacing

Sample Program (cont.)


DELAY_25:
MOV
LOOP2: MOV
LOOP1:
DJNZ
DJNZ
RET

R1,#49
R0,#0FFH

; second-loop counter
; first-loop counter

(1us)
(1us)

R0,LOOP1
R1,LOOP2

; loop 255 times


; loop 49 times

(2us)
(2us)
(2us)

Total time = 1 + ( 2255 + 2 + 1) 49 + 2 = 25.1ms

ECP2036 Microprocessor and Interfacing

You might also like