|
Pin configuration of a seven segment display:

LED’s are basically of two types
-
Common
Cathode (CC)
All the 8 anode legs uses only one cathode, which is common.
-
Common
Anode (CA)
The common leg for all the cathode is of Anode type.
For the discussion purpose, we
use CC LED, where by just reversing the logical voltages we can implement the
same for CA LED also.
In a CC LED, all the 8 legs
('a' through 'h') are of anode type and the common cathode will be connected to
the GND of the supply. By energizing any of the legs with +5 Volts will lead to
switch the correspondent segment ON. In the microprocessor binary system, 0Volts
will be considered as Binary 0, and 5Volts will be considered as Binary1.
Considering these two condition, we can make an arrangement as the
microcontroller gives OUT the 0s and 1s through its ports, which is connected to
the 8 legs of the LED. Of course, we can control the Port Output; implicitly we
can Switch-ON required legs of the display.
Here we discuss 2 methods of interfacing LED
with the Microcontroller Intel 8051/8951.
§
Using lookup table. This uses 7 output pins of microcontroller
§
Using 7447 decoder. This method uses 4 output pins of microcontroller
The difference between the two
main methods is simple and clear. In both the cases, microcontroller
communicates with external world through its ports. But, in the 1st case, we
connect all the 8 pins of the port directly to the LED and control the voltage
through the ports manually to display the desired number. But, in the second
case, we send the BCD of the number that we wanted to display to a middleware IC
7447, the BCD to LED code converter, which by itself gives out the correspondent
7 segment codes to the LED.
Using Lookup Table:
As we discussed, this method
uses the port of the microcontroller to display the desired number. The common
cathode pin is connected to GND by external wire, if it is the CC LED and in the
case of the common Anode LED, the Anode pin is connected to +Vcc. Here, other
pins of the LED are connected to Port 2 of 8951. A table will be prepared which
relates the BCD code to the LED display code (pattern). We call it as Lookup
table. The table below explains how we construct the Lookup table. Circuit
diagram is given below.

Circuit diagram for Common Anode 7-Segment Display

Circuit diagram for Common Anode 7-Segment Display
Calculation of lookup table as
follows:
The lookup table contains the input
pattern for the LED legs, to display the corresponding digits.
The table shows the seven segment requirement pattern to display the Hex number,
with the Seven segment conversion.
For example, Let us consider the display of the number 0, where we need to
switch ON all the LEDs which are there at the boundary. i.e. for a CC LED, we
should supply 5 volts to these LEDs. The 6 LEDs ('a' through 'f') should get
binary 1, the dot and the (middle) hyphen segment should get 0Volts or the
binary Zero. Effectively the Seven segment pattern code will be (0011 1111) 3Fh.
That is what we OUT through the port pins.
For a Common Anode LED, the display pattern will be the complement of that of
Common Cathode pattern.
For common Cathode :
|
Hex Number |
Seven Segment conversion |
Seven Segment equivalent |
| dot |
g |
f |
e |
d |
c |
b |
a |
| 0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
3F |
| 1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
06 |
| 2 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
5B |
| 3 |
0 |
1 |
0 |
0 |
1 |
1 |
1 |
1 |
4F |
| 4 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
66 |
| 5 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
6D |
| 6 |
0 |
1 |
1 |
1 |
1 |
1 |
0 |
1 |
7D |
| 7 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
07 |
| 8 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
1 |
7F |
| 9 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
67 |
For common Anode :
|
Hex Number |
Seven Segment conversion |
Seven Segment equivalent |
| dot |
g |
f |
e |
d |
c |
b |
a |
| 0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
C0 |
| 1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
1 |
F9 |
| 2 |
1 |
0 |
1 |
0 |
0 |
1 |
0 |
0 |
A4 |
| 3 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
B0 |
| 4 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
99 |
| 5 |
1 |
0 |
0 |
1 |
0 |
0 |
1 |
0 |
92 |
| 6 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
82 |
| 7 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
F8 |
| 8 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
80 |
| 9 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
98 |
Click here to get
ASM program for the above.
Related articles:
Seven segment display using 7447 decoder
|