Vous êtes sur la page 1sur 6

CLASS: T.E.

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.

Fig.: 7 segment display


Each one of the seven LEDs in the display is given a positional segment with one of its connection pins being
brought straight out of the rectangular plastic package. These individually LED pins are labeled
from a through to g representing each individual LED. The other LED pins are connected together and wired
to form a common pin.

Microcontrollers (T.E.E &TC) 2017_2018


4.1
So by forward biasing the appropriate pins of the LED segments in a particular order, some segments will be
light and others will be dark allowing the desired character pattern of the number to be generated on the
display. This then allows us to display each of the ten decimal digits 0 through to 9 on the same 7-segment
display.
The displays common pin is generally used to identify which type of 7-segment display it is. As each LED
has two connecting pins, one called the “Anode” and the other called the “Cathode”, there are therefore two
types of LED 7-segment display called: Common Cathode (CC) and Common Anode (CA).
The difference between the two displays, as their name suggests, is that the common cathode has all the
cathodes of the 7-segments connected directly together and the common anode has all the anodes of the 7-
segments connected together
1.2 The Common Cathode (CC)
In the common cathode display, all the cathode connections of the LED segments are joined together to logic
“0” or ground. The individual segments are illuminated by application of a “HIGH”, or logic “1” signal via a
current limiting resistor to forward bias the individual Anode terminals (a-g).

Microcontrollers (T.E.E &TC) 2017_2018


4.2
1.3 The Common Anode (CA)
In the common anode display, all the anode connections of the LED segments are joined together to logic
“1”. The individual segments are illuminated by applying a ground, logic “0” or “LOW” signal via a suitable
current limiting resistor to the Cathode of the particular segment (a-g).

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.

Fig.: Number display pattern on 7 segment display

Microcontrollers (T.E.E &TC) 2017_2018


4.3
1.3 Multiplexing
Often we need to use two, three or more SSDs and that too using only a single MCU, but one
problem that we face is the lack of I/O pins in the MCU, as one SSD would take 8 pins, and so
three SSDs would take 24 pins. One possibility is that we use a bigger MCU with more I/O pins,
Another much better and recommended solution to this problem is to multiplex the Seven Segment
Displays.
we use ‘Persistence of Vision‘. technique which is used in cinematography (display images so fast
that our brain cannot distinguish any lag between two consecutive images). Similarly, when we mux
more than one SSD, we display only one SSD at a time, and we switch between them so fast that
our eyes cannot sense a change so fast, and thus what we see is that all the displays are working
simultaneously.
What is actually happening in the hardware is that the MCU gives ‘1’ to the pin (remember, giving
‘1’ to the base of a BJT shorts the Collector and emitter junction?), which is connected to the base
of the transistor of the respective displays, keeps the port ‘ON’ for 5 milliseconds, and then turns it
off again. This procedure is put in an endless loop, so that we see the display continuously.

2.1 Interfacing of 7 segment display with 8051

Microcontrollers (T.E.E &TC) 2017_2018


4.4
2.2 Interfacing of multiplexed 7 segment display with 8051

3. Algorithm:

3.1 To display number 0 to 9

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

3.2 To display number 00 to 99

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

4. Source code (Attach separate Sheet)

5. References:

a. Mazidi, 8051 microcontroller & embedded system 3rd Edition ,Pearson

b. Datasheet of 8051 microcontroller

6. Result & Conclusion

____________________________________________________________

____________________________________________________________

____________________________________________________________

____________________________________________________________

Microcontrollers (T.E.E &TC) 2017_2018


4.6

Vous aimerez peut-être aussi