Home / MI Lab / Micocontroller / 8051 / Interfacing 7 Segment Display to 8051 Microcontroller

Interfacing 7 Segment Display to 8051 Microcontroller

Seven Segment Display:

Seven segment displays are used to indicate numerical information. Seven segments display can display digits from 0 to 9 and even we can display few characters like A, b, C, H, E, e, F, etc. These are very popular and have many more applications. Before going to start this concept, get an idea about how to interface LED with 8051 Microcontroller.

This article describes you how to interface seven segments to AT89C51 microcontroller. This system displays the digits from 0 to 9 continuously with a predefined delay.


Interfacing 7 Segment Display to 8051 Circuit Principle:

Seven segment displays internally consist of 8 LEDs. In these LEDs, 7 LEDs are used to indicate the digits 0 to 9 and single LED is used for indicating decimal point. Generally seven segments are two types, one is common cathode and the other is common anode.

In common cathode, all the cathodes of LEDs

are tied together and labeled as com. and the anode are left alone. In common anode, seven segment display all the anodes are tied together and cathodes are left freely. Below figure shows the internal connections of seven segment Display.



Internal Connections of Seven Segment


 Interfacing 7 Segment Display to 8051 Circuit Diagram:

Picture1 (3)



Circuit Components:

  • AT89C51 microcontroller
  • AT89C51 programming board
  • programming cable
  • 12V DC battery or adaptor
  • Common anode 7 segment Display
  • Connecting wires


Interfacing 7 Segment Display to 8051 Circuit Design:

Here, common anode seven segment is used to display the digits. In this circuit, pins a to h of the 7 segment are connected to the PORT 2 of the microcontroller and com pin is connected to the dc supply of 5 volt .Since we are using common anode seven segment we need to send LOGIC 1 to the segments to glow.

Figure shows structure of common anode seven segments. Here dot is used for indicating the decimal point. Here all the anode of LED’s are connected to the VCC pin. The operating voltage of this LED’s is 2 to 3V but from controller we will get 5V so to drop the remaining voltage we have to connect a to g pins to the controller through the resistor.




Digit Drive Pattern:

To display the digits on 7 segment, we need to glow different logic combinations of segments. For example if you want to display the digit 3 on seven segment then you need to glow the segments a, b, c, d and g. The below table show you the Hex decimal values what we need to send from PORT2 to Display the digits from 0 to 9.

segment code



sbit  s1=P1^0;
unsigned int hexx[12] = {0xff,0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67,0xff};

void delay()
unsigned int i,j;



void main()

unsigned int d;


for(d=11; d>0;d–)




How to Operate Interfacing 7 Segment Display to 8051 Circuit?

  1. Initially burn the program to the microcontroller.
  2. Give the connections as per the circuit diagram.
  3.  Make sure that a to g pins of 7 segment are connected to the P2.0 to P2.6 respectively.
  4. Switch on the supply, you can observe that digits 0 to 9 will display continuously with some delay.
  5. Switch of the supply.

Interfacing 7 Segment Display to 8051 Circuit Applications:

  • Seven segments are widely used in digital clocks to display the time.
  • These are used in electronic meters for displaying the numerical information.
  • Used in Instrument panels
  • Used in digital readout displays.

About Keval Chaudhari

I have recently passed my Bachelor of Engineering in Mechanical Branch. I have expertise in CAD system. Also, I am interested to make new things.

Check Also

I2C(Inter Integrated Circuit)/TWI(Two Wire Interface)

I2C(Inter Integrated Circuit)/TWI(Two Wire Interface) The I2C bus physically consists of 2 active wires and …

Leave a Reply

Be the First to Comment!

Notify of