AN842
APPLICATION NOTE
7-segment display drive
using the ST6-REALIZER
INTRODUCTION
Seven segment devices are often preferred in display applications where high luminescence is required,
both for indoor and outdoor applications.
Controlling the display is normally but one of many tasks handled by a typical application. The techniques
described in this note are of a general nature and may be applied to a variety of applications.
Hardware considerations are reviewed and generation of control software using the ST6-REALIZER is
described.
June 2008 Rev 2 1/8
7-segment display drive using the ST6-REALIZER
1 PRINCIPLE OF OPERATION
A 7-Segment Display consists of 7 LED's arranged in a figure-eight pattern, such that by selectively powering various combinations of segments alphanumeric characters may be displayed; a further LED is
present which, when powered, causes a dot or decimal point to be displayed (Figure 1). Each LED is
turned on by forward biasing its respective anode, all segment cathodes being commoned (Common Anode devices also exist).
The Digital Point LED is generally used to display numbers containing a non-integer part. Table 1 illustrates the required segment patterns for numeric representation, including the optional Decimal Point
character.
Figure 1. Structure of a 7 segment display
Table 1. LED's turned on for a given digit
abcde f gDP
0 1111110 X
1 0110000 X
2 1101101 X
3 1111001 X
4 0110011 X
5 1011011 X
6 1011111 X
7 1100000 X
8 1111111 X
9 1111011 X
DPXXXXXXX 1
X = Don't care
Biasing can be either continuous or multiplexed as long as the refresh frequency is high enough to ensure
image persistence for the human eye (at least 20 cycles per second to avoid flicker).
2/8
7-segment display drive using the ST6-REALIZER
2 PRACTICAL IMPLEMENTATION
2.1 Hardware layout
Biasing is achieved using the ST62 MCU's I/O lines. One line is used to bias the common cathode, while
7 lines are assigned to LED segments a - g and a further line, if required, to the DP. Each segment of the
display can thus be turned on or off, depending on the value written to the corresponding I/O line.
2.2 Software generation
Control software is automatically generated by the ST6-REALIZER, on the basis of a functional description.
The digit to be displayed is available as a variable, "Digit value". The display control software must then
write the relevant value to the I/O lines in accordance with Table 1.
The ST6-REALIZER library provides a component, the lookuptable, for this kind of application. This table
assigns to each variable input value a constant output value defined in the ROM memory of the ST62
MCU. If a lookup table is defined for each LED or segment, the output data is of BIT type as shown in the
Figure 2 for segment g.
Figure 2. Lookup table for segment g
Finally, the resultant bits are transferred to the I/O port via the digout components (Figure 3).
3/8