The seven segment display is one of the commonly used display devices in the world of electronics. Easy of operation and good visual indication has made their use in low cost circuits e.g. counter and speedometer and even in costly devices e.g. power system static protective relays. Seven segment display is a great utility at low cost.

Seven segment display Video


Seven segment display is collection of seven led. In a simple LED package, each LED is typically connected with one terminal to its own pin on the outside of the package and the other LED terminal connected in common with all other LEDs in the device and brought out to a shared pin. This shared pin will then make up all of the cathodes (negative terminals) OR all of the anodes (positive terminals) of the LEDs in the device; and so will be either a "Common Cathode" or "Common Anode" device depending how it is constructed.

How to display digits on seven segment display

Apply proper polarity to common pin.

Make the required segment pin low or high depending on the type of display.

You can refer the table given below to send respective hex value for displaying numbers from 0 to 9.

Interfacing seven segment display to microcontroller

In early days to drive the seven segment decoder was used with it and the BCD was send to the decoder IC. But the microcontroller has eliminated the use of decoder as already decoded data is sent to the seven segment display.

Common anode display are most suitable for interfacing with 8051 since 8051 port pins can sink current better than sourcing it.

Connect the a to g pins and dot pin of seven segment display to the 8-bit port of microcontroller

Now send the respective hex data to display specific number on seven segment display on that port.

Give some delay and repeat the process if you want to display another digit.

Circuit Diagram

Note: Change the value of resistor to obtain required contrast.

Source Code: 7seg.asm



Back to Main Page