For the seven segment display you can use the LT-541 or LSD5061-11 chip. Each of the segments of the display is connected to a pin on the 8051 (the schematic shows how to do this). In order to light up a segment on the the pin must be set to 0V. To turn a segment off the corresponding pin must be set to 5V. This is simply done by setting the pins on the 8051 to ‘1’ or ‘0’.
7-SEG Display are available in two types -1. Common anode & 2. common cathode , but command anode display are most suitable for interfacing with 8051 since 8051 port pins can sink current better than sourcing it.
For displaying Digit say 7 we need to light segments -a ,b, c. Since we are using Common anode display , to do so we have to to provide Logic -0 (0 v) at anode of these segments.
so need to clear pins- P1.0 ,P1.1,P1.2. that is 1 1 1 1 1 0 0 0 –>F8h .
CREATING DIGIT PATTERN
For displaying Digit say 7 we need to light segments -a ,b, c. Since we are using Common anode display , to do so we have to to provide Logic -0 (0 v) at anode of these segments.
so need to clear pins- P1.0 ,P1.1,P1.2. that is 1 1 1 1 1 0 0 0 –>F8h .
Connection
Segment number | 8051 pin number |
a | P1.0 |
b | P1.1 |
c | P1.2 |
d | P1.3 |
e | P1.4 |
f | P1.5 |
g | p1.6 |
h(dp) | P1.7 |
You can also do this for some characters like A ,E .. but not for D or B because it will be same as that of 0 & 8 . So this is one of limitation of 7-seg display.
Since we can Enable only one 7-seg display at a time ,we need to scan these display at fast rate .The scanning frequency should be high enough to be flicker-free. At least 30HZ .Therefore – time one digit is ON is 1/30 seconds
INTERFACING
Note that I am using Common Anode display. so the common Anode pin is tied to 5v .The cathode pins are connected to port 1 through 330 Ohm resistance (current limiting).
Common Anode display
Source: maheshwankhede