7-segment display basics

7 segments

7-segment-naming
Figure 1. Standard 7-segment display layout and segment identification. The decimal, if supplied, point requires an eight LED.

7-segment (or “seven-segment) LED displays are commonly used to display digital information. Each segment consists of one or more LEDs and can be lit independently of all the others to form the digits 0 to 9. A limited range of alphabetic characters can also be formed but these are of mixed case and can be difficult to read.

The standard segment identification is shown in Figure 1 and segments are named A to G starting at the top and going clockwise with G being the centre segment.

Typically the displays have a common pin for all the LED anodes or cathodes. Eight pins will suffice for a true seven-segment display whereas nine are required for one with a decimal point.

Common anode 7-segment display.
Figure 2. As might be expected, package pin-count is reduced by using a common pin for one side of all the LEDs. In this case a common anode is used.
7-segment display with common cathode.
Figure 3. A common cathode display. These have the advantage that, for multiplexed displays, the digit can be strobed using an NPN transistor in the cathode connection to ground.

Multiplexed 7-segment display

7-segment display, 4-digit.
Figure 4. 4-digit multiplexed common-cathode display.

By multiplexing seven-segment displays the number of pins required to drive the displays can be reduced. In the scheme of Figure 4 the segments are driven high by the micro-controller. The required segments for digit 1 are set on lines A to G and Q1 strobed (turned on briefly). Then the required segments for digit 2 are turned on and Q2 is strobed, etc. The sequence is run quickly enough that all digits appear to be continuously lit due to persistance of vision.

When multiplexing displays in this manner it is normal to run at a current higher than nominal. This is acceptable because the segments will be powered for a maximum of 25% of the time – 25% duty-cycle.

Note that 32 segments can be controlled using only 12 outputs from the controller.  This efficiency in hardware and PCB layout is what makes multiplexing so popular.

Reducing controller pins

4511 BCD to 7-segment decoder
Figure 5. The 4511 BCD to 7-segment latch / decoder / driver.

By using a latch / decoder / driver such as the 4511 decoder (datasheet) the designer has many more options for display. By using the BCD decoder only four lines are required to drive the seven segments.

4511 function diagram.
Figure 6. 4511 function diagram.
  • BL: blanking. Pull low to turn all segments off. Display: blank.
  • LT: lamp-test. Pull low to turn all segments on. Display: ‘8’.
  • LE: latch enable. Pull low to read the inputs and pass through to the seven segment outputs. Pull high to latch the outputs.

Note that BCD values above ‘9’ are considered void and the display will be blank. This renders the 4511 unsuitable for hexadecimal display.

The 4511 can source or sink current for the displays. See the datasheet for ratings.

Flicker-free 7-segment display

Flicker-free multi-digit 7-segment display.
Figure 6. By using a 4511 latch per display a flicker-free display is possible.

Figure 5 shows how to use a 4511 latch per digit. In this case the data for each digit is set up in turn on D0 to D3 and the digit’s /LE (latch enable) pin is pulled low. The seven-segment display will immediately update and will be latched when the /LE pin is pulled high again. This, for example, would allow the micro to handle other tasks without having to update the display until required. The D0 to D3 IO pins could even be used as inputs with suitable input resistors while the diplay update is not required.

Note that the display decimal points are not controlled by the 4511. This leaves the designer with several options:

  • No decimal point.
  • A fixed decimal point by wiring one of the DP pins to Vss.
  • Program controlled decimal point. This will require one extra controller output pin per decimal point.

Multiplexed display – the basics

Multiplexing is a technique used to connect devices – typically LEDs (for displays) or buttons (for keyboards) – in a matrix of addressable rows and columns. The advantage is simplification of hardware due to the reduced number of pins required. Multiplexed displays using seven-segment LEDs remain popular due to low cost and high brightness.

Multiplexed LED display.
Figure 1. An LED matrix display. Each LED can be turned on individually by closing the appropriate row and column switches. In practice some form of current limiting is required.
One multiplexed LED switched on.
Figure 2. By closing switches 2 and 6 we can turn on LED 7 alone. Current flows through (1), (2) and (3).

A practical circuit uses tranistorised switches. Each row is switched on in sequence (S1, then S2 and then S3) and the corresponding switches S4, 5, 6 and 7 closed in synch to switch on the desired LEDs. To fool the eye into seeing a continuous display the sequencing is typically done at more than 50 times per second.

In the example of Figure 1, only seven lines are required to switch twelve LEDs. The pin-count saving increases with larger displays as the pin-count (for a square matrix) is the square root of the number of LEDs. This reduces the pins required on the controller, reducing cost and circuit board complexity.

Since the LEDs are now on for only a fraction of the time it is necessary to pulse them with higher current. See LED current rating for more details.

Sneak paths

Multiplexed LEDs 3 x 2 sneak paths
Figure 3. If reverse currents are possible through the LEDs then unexpected problems can result.

Figure 3 shows a problem that can occur on higher voltage supplies if reverse current flow is possible. (This can happen on keyboard matrices if diodes are not used to prevent it.) In this case we might expect that with S2 and S4 closed that only L5 will light. There are, however, sneak paths as shown in blue on the diagram and ghosting may appear on other LEDs. With non bi-directional LEDs this will not be a problem.

Alphanumeric multiplexed display

A multiplexed seven-segment LED display.
A six-character sixteen-segment alpha-numeric display and two-digit seven-segment multiplexed LED display on a DigiTech RP335 guitar effects unit. Exposure time 1/15 s.
Multiplexed LED alpha-character display photographed at high speed.
A 1/2000 s photo of the same display catches the alpha character ‘N’ lit up on one of the sixteen-segment displays.
Multiplexed seven-segment LED display pair photographed at high speed.
Another 1/2000 s shot of the same display catches the two seven-segment numeric displays lit simultaneously.

The fact that the two 7-segment displays are on simultaneously suggests that these displays are wired in seven “columns” (six for the alpha displays and one for the pair of digits) and sixteen “rows” (one per starburst segment). The alpha characters require sixteen data lines so it makes sense to connect the two seven-segment displays to fourteen of these and strobe them all at once.

This video demonstrates the multiplexing display using a video camera under varying background illumination.