Académique Documents
Professionnel Documents
Culture Documents
E &TC SUBJECT: MC
EXPT. NO.: 4 DATE:
TITLE: Interfacing of 7-segment Display
PROBLEM STATEMENT:
A. Write a program to display BCD number (0 to 9) on 7- segment.
B. Interface 7 Segment displays with 8051 and write an ALP to display BCD values up to two digits
(00H to 99H).
OBJECTIVE:
a. To understand the Keil IDE.
b. To study interfacing of with 7- segment display with 8051
c. To study 7 segment display (common cathode & common anode) working
d. To study working of display of numbers on more than two 7- segment display
S/W PACKAGES USED:
Keil IDE, Windows 7
1. THEORY
1.1 7-Segment Display
The 7-segment display, consists of seven LEDs arranged in a rectangular fashion as shown. Each of the seven
LEDs is called a segment because when illuminated the segment forms part of a numerical digit (both
Decimal and Hex) to be displayed. An additional 8th LED is sometimes used within the same package thus
allowing the indication of a decimal point, (DP) when two or more 7-segment displays are connected
together to display numbers greater than ten.
In general, common anode displays are more popular as many logic circuits can sink more current than they
can source. Also note that a common cathode display is not a direct replacement in a circuit for a common
anode display and vice versa, as it is the same as connecting the LEDs in reverse, and hence light emission
will not take place.
Depending upon the decimal digit to be displayed, the particular set of LEDs is forward biased. For instance,
to display the numerical digit 0, we will need to light up six of the LED segments corresponding to a, b, c, d,
e and f. Then the various digits from 0through 9 can be displayed using a 7-segment display as shown.
3. Algorithm:
1. Start
2. Store the values corresponding to numbers 0 to 9 at ROM using ORG and DB instruction
3. Read value from pre-store data location using DPTR and send it to port pins to display
associated number
4. Call delay subroutine
5. Repeat step 3 – 4 till all numbers from 0 to 9 get displayed.
6. Stop
1. Start
2. Store the values corresponding to numbers 0 to 9 at ROM using ORG and DB instruction
3. Initialize counter0, counter1 to 10, transistor1 and transistor2
4. Read value from pre-store data location using DPTR and send it counter0 and counter1
5. Send value at counter0 to port pins, make transistor1 on and transistor2 off
6. Send value at counter1 to port pins, make transistor1 off and transistor2 on
7. Call delay subroutine
Microcontrollers (T.E.E &TC) 2017_2018
4.5
8. Increment counter0, repeat step 4-7 if not 10. If 10 make counter0 0.
9. Repeat step 3 – 4 till all numbers from 0 to 9 get displayed.
10. If counter0 is 10 Increment counter1, if counter1 is not 10 repeat step 4-9. If 10 make
counter1 0.
11. Stop
5. References:
____________________________________________________________
____________________________________________________________
____________________________________________________________
____________________________________________________________