AN1781
APPLICATION NOTE
STR71x GPIO
DRIVING FOUR 7-SEGMENT DISPLAY
Seven-segment devices are often preferred in display applications where high luminescence is required, both for indoor and outdoor applications. Segments are marked with letters: a, b, c, d, e, f, g and DP, where DP is the decimal point.
The technique described in this note is of a general nature and may be applied to a variety of applications.
Hardware considerations are reviewed and generation of control software using the STR71x is described.
Rev. 2
AN1781/0205 |
1/8 |
1
STR71x GPIO DRIVING FOUR 7-SEGMENT DISPLAY
A 7-segment display consists of 7 LED’s arranged in a figure-eight pattern, then by selectively powering-on various combinations of segments, alphanumeric characters may be displayed; a further LED is present which, when powered-on, causes a dot or decimal point to be displayed (Figure 1). The LED display can be driven by a common cathode or common anode. With a common cathode display, the common cathode must be connected to the 0V rail and the LEDs are turned on with a logic one.
Table 1 illustrates the required segment patterns for each numeric representation, including the optional decimal point.
Figure 1. Structure of a 7-segment display
a
f |
|
b |
|
|
|
g
e |
|
c |
|
|
|
d |
DP |
|
2/8
2
STR71x GPIO DRIVING FOUR 7-SEGMENT DISPLAY
Table 1. LEDs turned on for a given digit
|
a |
b |
c |
d |
e |
f |
g |
DP |
Hex |
|
|
|
|
|
|
|
|
|
|
0 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
x |
0x3F |
|
|
|
|
|
|
|
|
|
|
1 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
x |
0x06 |
|
|
|
|
|
|
|
|
|
|
2 |
1 |
1 |
0 |
1 |
1 |
0 |
1 |
x |
0x5B |
|
|
|
|
|
|
|
|
|
|
3 |
1 |
1 |
1 |
1 |
0 |
0 |
1 |
x |
0x4F |
|
|
|
|
|
|
|
|
|
|
4 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
x |
0x66 |
|
|
|
|
|
|
|
|
|
|
5 |
1 |
0 |
1 |
1 |
0 |
1 |
1 |
x |
0x6D |
|
|
|
|
|
|
|
|
|
|
6 |
1 |
0 |
1 |
1 |
1 |
1 |
1 |
x |
0x7D |
|
|
|
|
|
|
|
|
|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