7-segment Display Counter

Table of Contents

Nowadays it is very easy to display numbers and letters across multiple LED displays using micro-controllers, such as the Arduino or Raspberry-Pi, along with a small bit of software related code to display the required digits. But sometimes as an Electronics student or hobbyist we want to display two or more numbers or digits as part of our project or digital logic circuit. So how can we do this.

7-segment displays provide a convenient way of displaying numerical information from zero to nine as they basically consist of a load of light emitting diodes connected together within a single indicator package. Each light emitting diode (called a segment) is illuminated using an electrical current, and by illuminating various combinations of segments so that some segments will be turned “ON” and emitting light while others will be turned “OFF” we can display individual characters or numbers.

As we saw in our tutorial about the Light Emitting Diode, LEDs are just like normal diodes, in that they only allow current to flow in one direction. This difference between the two is that an LED emits light energy from its PN-junction when an electrical current passes through it. This electroluminescence action occurs whenever the Anode (A) terminal of the LED is more positive than its Cathode (K) terminal by approximately 2 volts. The typical supply current required to illuminate an LED junction ranges from between about 6mA to 20mA and whos value is commonly controlled using a resistor in series with the LED.

So by forward-biasing any one of the displays LED segments so that the anode terminal is towards the supply (positive) and the cathode terminal is towards ground (negative), we can produce a set of randomly lit segments or a decimal number from 0 to 9 providing a visual output for our project.

7-Segment Display

7-segment display

As its name suggests, a 7-segment display consists of seven segments, meaning it consists of seven light emitting diodes or LED’s, which together can be used to form one complete digit on the display.

Actually, most 7-segment displays contain eight internal LED’s as the eigth one is used for a decimal point, usually in one of the bottom corners of the display.

So if a 7-segment display consists of seven LED’s (ignoring the decimal point for now), one for each segment, and an LED has two terminals, an Anode and a Cathode, does that mean that each single 7-segment display will have 14 connecting pins or terminals. Well the answer is, No.

While an LED segment can be illuminated individually as required, one terminal of each internal LED is connected to a common point or node. Thus instead of having 14 connecting pins for the display we will only have only eight (7 + 1) pins, one each for the seven individual LEDs plus a common pin, and it is this “common pin” which identifies the type and name of 7-segment display.

When the cathode terminals of all the LEDs used in the display are shorted together, the display is referred to as a Common-cathode, (CC) display. Likewise, when all the anode terminals of the LEDs used in the display are shorted together, the display is referred to as a Common-anode, (CA) display. Thus a 7-segment display can be either a Common Cathode (CC) or a Common Anode (CA) type display.

Common Cathode (CC) Configuration

common cathode configuration

The Common Cathode (CC) Display – In the common cathode display, all the cathode (K) connections of the LED segments are tied together and connected to ground or zero-volts. The individual segments are illuminated by the application of a suitable electric current to forward bias the individual Anode terminals (a to g). Thus common cathode display requires a driving circuit that can source a current.

Common Anode (CA) Configuration

common anode configuration

The Common Anode (CA) Display – In the common anode display, all the anode (A) connections of the LED segments are joined together to a positive voltage supply. The individual segments are illuminated by applying a ground, or “LOW” signal to the Cathode terminal of the particular segment (a to g). Thus a common anode display requires a driving circuit which can sink a current.

There are many different ways to connect multiple 7-segment LED displays to an electronic circuit, with each one having its own advantages. Because each individual segment requires about 6 to 20 milli-amperes (mA) of current to illuminate it for normal brightness, and as there are seven segments (plus a decimal point), generally dedicated decoder/driver chips are used to drive each display directly.

IC decoder chips basically convert one type of input data into another type and there are different types of digital decoders available depending upon the type of input data (such as binary, BCD, or hex), and the required output code representing the number of decoded output lines. For example: 3-to-8 lines, 4-to-16 lines, etc.

In our case we require a decoder chip which can convert some binary code into a set of output signals to drive a 7-segment display such as a “BCD-to-seven-segment decoder”. Binary Coded Decimal, or BCD for short, is a set of 4-bit binary digits used to represent the 10 decimal digits from 0 to 9 with the following list of IC decoder chips which are able to do just that.

TTL Decoder IC’s

  • 74LS47 Common Anode
  • 74LS48 Common Cathode
  • 74LS247 Common Anode
CMOS Decoder IC’s

  • 74HC4511 Common Cathode
  • CD4513 Common Cathode

The TTL 74LS47 is the most popular 7-segment decoder IC by far and which is capable of driving common anode (CA) displays. The TTL 74LS47 has a 4-bit BCD input and seven individual active “LOW” outputs for driving each of the seven LED segments. Active “LOW” means the output pin switches to ground (0V) to light an LED segment, while a “HIGH” output will turn the LED segment “OFF”. The HDSP series of displays is a good starting point but any standard common anode display will do, (and there are plenty to choose from).

With the aid of four switches, a 4-bit binary number is applied to the BCD inputs ABC and D of the 74LS47 decoder to produce the output signals a, b, c, d, e, f and g used to drive the 7-segment display generating the required numbers from 0 to 9 as shown.

The 74LS47 Decoder

74ls47 decoder driver

The connection between the 74LS47 decoder/driver and the common anode display, requires seven resistors (eight if the decimal point is included) to limit current flow. For each LED segment of the display to light properly, the flow of current through each segment needs to be carefully controlled. The best method of limiting the current through a displays segment is to use a current limiting resistor in series with each of the seven LED segments as shown. If we do not use a series connected resistor, maximum current would flow and the LED would be very bright for a short period of time, before becoming permanently destroyed.

As each LED segment of a typical 7-segment LED display is rated to operate at between 6 to 20mA offering a voltage drop across the LED’s diode junction of about 1.8 volts for normal brightness. We can calculate the value of the current-limiting resistor needed to produce the required current per LED segment.

display segment resistance

Hopefully by now we have learnt and understood that a 7-segment display is basicaslly a bunch of individual LED’s within a single rectangular package and that LED’s require a series resistor to limit their DC forward current per segment.

For a common-anode display, the anodes of each LED segment are connected together to a 5 volt supply, (VS). If when illuminated the forward voltage drop across the LED’s junction is about 1.8 volts, then the voltage across the series resistor must be equal too: VS – VLED = 5 – 1.8 = 3.2 volts.

So the resistive value required for the series current limiting resistor of a single segment is simply found using Ohm’s Law at the required current flow to illuminate it. Therefore we can calculate the range of resistance required to limit the LED’s current to between 6mA and 20mA for whatever application and LED intensity we want as follws:

7-segment Display Resistor Values

7-segment display resistor value

Thus at 6mA current we would require a series current limiting resistor of 533Ω, or 560Ω to the nearest preferred value, and to limit the current to 20mA we would require a resistor of 160Ω. In reality, any good standard preferred resistor value of between 220Ω and 360Ω could be used to illuminate a 7-segment display from a 5 volt supply, it all depends on what resistor values you have available.

Although here we are using a common anode LED display as our example, the same calculations and resistive values are also true for the common cathode LED displays. Dual-in-line package (DIP) resistor networks are commonly available with all seven (or eight) resistors within in a single DIP package simplifying the wiring process between driver IC and display.

Note also that while we have used here the TTL 74LS47 BCD to 7-segment decoder/driver IC with its active LOW (current sink) outputs for driving a common anode display, the TTL 74LS48 BCD to 7-segment decoder/driver IC is exactly the same except that it designed to drive a common-cathode display as it produces active HIGH (current source) outputs. So depending upon which type of 7-segment LED display you have you may need a 74LS47 IC for driving, let’s say for example a LT542 CA display, or a 74LS48 IC for driving its equivalent LT543 CC display. The choice is yours.

Displaying Numbers on a 7-segment Display

The 74LS47 has four inputs for the BCD (8-4-2-1) digits ABC and D, and outputs for each of the segments of the seven-segment display. Operation of four switches SA, SB, SC and SD, will generate the necessary input sequence to activate the appropriate LED segments responsible for displaying the corresponding number. For normal operation, the LT (Lamp test), BI/RBO (Blanking Input/Ripple Blanking Output) and RBI (Ripple Blanking Input) of the 74LS47 are all connected to the +5V supply (HIGH). Thus the numbers displayed are as follows:

7-segment Display Numbers

7-segment display numbers

7-Segment Display Elements for all Ten Number Digits

While the operation of the four SPST switches will cause the corresponding numbers or random characters to display, it can be a bit tedious operating the four switches at a time. So it would be better if we had a single IC chip that was able to generate the 4-line binary information without using the four switches, and there is, the 74LS90 BCD Counter.

The 74LS90 integrated circuit that can be configured as a MOD-10 decade (divide-by-10) counter to produce a BCD output code, counting from 0000 to 1001 and then resets itself back to 0000. By using this asynchronous decade counter/divider IC, we can increment the digits on the 7-segment display using just one single switch as shown.

Single Digit 7-segment Display Counter

single 7-segment display counter

We can now increment the numbers on the display from 0 to 9 by simply pressing one pushbutton switch, SW1 ten times. By changing the position of the push button and 1kΩ resistor, the count can be made to change on either the activation or the release of the pushbutton, SW1.

Our simple circuit shows how we can produce a 0 to 9 digital counter using a 74LS90 BCD Counter and a 74LS47 7-segment display driver. But this single-digit 0 to 9 counter can be extended with the addition of a second counter stage to make a two-digit 00 to 99 counter.

Two Digit 7-segment Display Counter

two digit 7-segment display counter

So how does this 2-digit 7-segment display counter work. The first half of the digital counter circuit works the same as before except that the activation of the pushbutton SW1 increments the “one’s” (also called “units”) LED display. The first 74LS90 BCD counter, U1 counts upwards from 0 to 9 (0000 to 1001) on each closing (trailing-edge) of SW1. However, when the counting sequence reaches “8” (1000) on the one’s display, pin-11 of U1 corresponding to output “D” goes “HIGH” and stays HIGH until U1 resets itself back to zero on the 10th count at which time pin-11 of U1 goes “LOW” again.

As output pin-11 (BCD pin D) of U1 is connected to the clock A (CLKA) input pin-14 of the second 74LS90 BCD counter U3, each sucessive HIGH/LOW switching action of pin-11 (output D) of U1 increments the second LED display for the ten’s digit. Thus causing the two LED displays when placed side-by-side to count upwards from 00 to 99 before restting back to 00 again for the next count.

This very simple digital counting circuit has many different school project applications. For example, if we can replace the manually operated pushbutton switch, SW1 with a sensor to count moving objects, or people, or cars, etc. Or even replacing SW1 with a 555 timer or astable oscillator circuit for example, it could be used to count a number of pulses, or as a simple 2-digit timer or reaction timer circuit with or without the decimal point.

While the above 2-digit counter circuit works well with the 74LS90 decade (divide-by-ten) counter, the problem is we need two of them, U1 and U3. The TTL 74LS390 and its CMOS equivalent, the 74HC390, contain two 74LS90 decade counters within a single IC package and in most cases is more cost effective than buying two 74LS90’s.

The TTL 74LS390 4-bit decade counter has two divide-by-two and divide-by-five counters internally which can be configured as a divide-by-multiples of “2, 5 or 10” with a BCD output the same as for the single 74LS90. Thus we can replace the two 74LS90 IC’s U1 and U3 in the previous circuit with one single 74LS390 IC with each half of the IC driving one of the LED displays as shown.

Improved Two Digit Counter

improved two digit counter

The circuit shows a simple 00 to 99 digital counter using a 74LS390 BCD Counter and two 74LS47 7-segment display drivers. To count above 99, we would need to cascade more counter circuits together. A 4-digit BCD counter would count in decimal from 0000 to 9999 and then reset back to 0000. Likewise, if we wanted to count from 0 up to 999999, then three cascaded decade counters are required. In fact multiple decade counters can be constructed simply by cascading together individual BCD counter circuits, one for each decade as shown.

Cascading Counters

cascading counters

We have seen here in this tutorial about the 7-segment Display Counter, that LED display decoder circuits can be constructed using standard combinational logic circuit IC’s and that there are many dedicated integrated circuits on the market to perform this function. Display decoder IC’s such as the 74LS47 7-segment decoder/driver IC for driving a common anode (CA) display, or the 74LS48 7-segment decoder/driver IC for driving a common cathode (CC) display are commonly available along with their CMOS equivalents.

The 74LS90 asynchronous counter IC can be configured as a MOD-10 decade (divide-by-10) counter to produce a BCD output code, counting upwards from 0000 to 1001 and then resetting itself back to 0000 to start the cycle again.

The 74LS90 BCD Counter is a very flexible counting circuit and can be used as a frequency divider or made to divide any whole number count from 0 to 9 for a single display. Cascading together two 74LS90 counters allows us to produce a 2-digit counter, but better still, using the dual decade/driver IC 74LS390 we can produce any combination of counter stages using multiple 7-segment LED displays.


Similar Articles & Blogs

Explore similar articles on various electronics and electrical topics – 

Binary Coded Decimal

As we have seen in this Binary Numbers section of tutorials, there are many different binary codes used in digital and electronic circuits, each with

Learn More >>

Binary Fractions

We know that decimal (or denary) numbers use the base ten (base-10) numbering system where each digit in a decimal number is allowed to take one

Learn More >>

Octal Number System

The Octal Numbering System is very similar in principle to the previous hexadecimal numbering system except that in Octal, a binary number is divided up into groups

Learn More >>

Hexadecimal Numbers

The one main disadvantage of binary numbers is that the binary string equivalent of a large decimal base-10 number can be quite long. When working with

Learn More >>