7-segment counter

A seven-segment display is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot-matrix displays. Seven-segment displays are widely used in digital clocks, electronic meters, and other electronic devices for displaying numerical information.

   A seven segment display, as its name indicates, is composed of seven elements. Individually on or off, they can be combined to produce simplified representations of the Arabic numerals. The seven segments are arranged as a rectangle of two vertical segments on each side with one horizontal segment on the top, middle, and bottom.

   The segments of a 7-segment display are referred to by the letters A to G, as shown in Fig.(1), where the optional DP decimal point (an “eighth segment”) is used for the display of non-integer numbers.


Fig.(1): Seven Segment


Fig.(2): 7-Segment Display

The animation to the below Fig.(2) cycles through the common glyphs of the ten decimal numerals and the six hexadecimal “letter digits” (A–F). It is an image sequence of a “LED” display, which is described technology-wise in the following section. Notice the variation between uppercase and lowercase letters for A–F; this is done to obtain a unique, unambiguous shape for each letter (otherwise, a capital D would look identical to an 0 (or less likely O) and a capital B would look identical to an 8).

In a simple LED package (like the 7-segment display), typically all of the cathodes (negative terminals) or all of the anodes (positive terminals) of the segment LEDs are connected together and brought out to a common pin; this is referred to as a “common cathode” or “common anode” device (see Fig.(1)) . Hence a 7 segment plus decimal point package will only require nine pins. This table gives the hexadecimal encoding for displaying the digits 0 to F:


Fig.(3): 7-Segment Table

In this tutorial, a seven-segment display is controlled via a PIC16F877A Microcontroller as shown in Fig.(4). The seven segment displays the number sent from the PIC, which represents a counter digits ranged from 0-9. In this circuit, a common cathode seven-segment display is utilized. This display is controlled from PIC16F877A via SN7448, BCD to seven-segment counter decoder. Using the decoder to control the seven-segment is an optional choice since the seven-segment can be controlled directly from the Microcontroller but in such case more pins from PORTB, the one used in this tutorial, will be used.


Fig.(4): Circuit Diagram