# Interfacing Seven Segment Display to 8051 Microcontroller with Circuit Diagram

##### INTERFACING SEVEN SEGMENT DISPLAY WITH 8051 MICROCONTROLLER

INTRODUCTION:

• It is primarily an electronic device used for displaying alphanumeric values or decimal values.
• The Seven segment display more commonly used on display board in various complexes and shopping malls.
• The pivotal role of this display board is to show some command or instructions to the humans that is understandable to them.

CIRCUIT DIAGRAM:

###### WORKING:

Common Anode Configuration:

• Depending on the decimal digits to be displayed the particular set of LED’S are forward biased.
• Example:  If we want to light the digit 8 seven digits has to be lighted up in order to display it.

TRUTH TABLE:

• The above table indicates the corresponding LED’s to be displayed in order to get the corresponding numbers.(0-9).
• Both common cathode and common cathode is present.

PIN DIAGRAM:

CODING FOR SINGLE DIGIT:

#include<reg51.h>

void delay(int k) //delay function

{

int i,j;

for(i=0;i<k;i++)

for(j=0;j<1275;j++);

}

void main()

{

unsigned char i;

unsigned char arr[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};

P2=0x00;

while(1)

{

for(i=0;i<10;i++)

{

P2=arr[i];

delay(100);

}

}

}

PROCEDURE:

1. Firstly burn the program to microcontroller.
2. Then make the connections as per circuit diagram.
3. We must make sure that pins a to g of seven segment are given to P2.0 to P2.6 of microcontroller(PORT 2).
4. Switch on the power supply then he numbers 0 – 9 starts displaying after some interval.
5. This process repeats itself in an infinite loop.

CONNECTION DIAGRAM:

PROJECT EXECUTION VIDEO:

Click here to see the Video