Spread the love

interfacing 7 segment display with 8051___________________________________________________________________________________________________

  • What is SEVEN SEGMENT DISPLAY (SSD)? – A seven segment display is a form of electronic display device for displaying decimal numbers (and some alphabets too). SSD may use a liquid crystal display (LCD), a light-emitting diode (LED) for each segment, or other light-generating or controlling techniques such as cold cathode gas discharge, vacuum fluorescent, incandescent filaments, and other.

interfacing 7 segment display with 8051

  •  Types of SSD– There are mainly two types of SSD available. In a simple LED package, typically all of the cathodes (negative terminals) or all of the anodes (positive terminals) of the segment LEDs are connected and brought out to a common pin; this is referred to as a “common cathode” or “common anode” device. Besides this, there is also a SSD multiplexer is used called 2 digit, 3 digit and so on as you can see on photos.

 Incandescent light 7 segment display 7segment1

  • Operation – In a simple common cathode LED package SSD, there has 10 pin out of which 2 is ground and rest is LED segments . Particular LED segment is glow(ON) by giving logic ‘1’ to it and rests at logic ‘0’.

So we need to program this 8 pin to display our number on SSD. In following table, we convert this 8 pin’s in 8 bit binary data and then that data into hex number and shows the hex number of displaying digits below.

 

Digit Hex code A B C D E F G
0 0x3F 1 1 1 1 1 1 0
1 0x06 0 1 1 0 0 0 0
2 0x5B 1 1 0 1 1 0 1
3 0x4F 1 1 1 1 0 0 1
4 0x66 0 1 1 0 0 1 1
5 0x6D 1 0 1 1 0 1 1
6 0x7D 1 0 1 1 1 1 1
7 0x07 1 1 1 0 0 0 0
8 0x7F 1 1 1 1 1 1 1
9 0x6F 1 1 1 1 0 1 1
                 
                 

use of 7 segment display

 

  • Applications-  SSD is widely use in digital clocks, pricing menu at petrol pump, in metros and electronics meters as shown above.

1.Circuit Diagram of COMMON ANODE  7  SEGMENT  DISPLAY With 8051

7 segment display with 8051

1. Program Of 0 To 9 Counter On Anode 7 Segment Display With 8051

/******************************************************
IDE :- Keil
DEVELOPED BY:- FIRMWARE DEVELOPER (www.firmcodes.com)
WHAT PROGRAM DO:- COUNT 0 TO 9 ON 7 SEGMENT  DISPLAY with 8051
CATHODE CONNECTED TO PORT 1
******************************************************/

#include<reg51.h> // this is the header file used in programming of AT89C51

void delay();    // for delay

 void main()
    {
        while(1)
          {
              P1= 0x3f;
              delay();
              P1=0x06;
              delay();
              P1=0x5b;
              delay();
              P1=0x4f;
              delay();					    
              P1=0x66;
              delay();
              P1=0x6d;
              delay();
              P1=0x7d;
              delay();
              P1=0x07;
              delay();
              P1=0x7f;
              delay();
              P1=0x6f;
              delay();
          }
     }

void delay()    // for delay
 {
     unsigned int i,j;
     for(i=0;i<100;i++)
       for(j=0;j<1000;j++);
 }

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1) _____________________________________________________________________________________________

2. Program Of 000 To 999 Counter On Anode 7 Segment Display With 8051

 

/******************************************************
IDE :- Keil
DEVELOPED BY:- FIRMWARE DEVELOPER (www.firmcodes.com)
WHAT PROGRAM DO:-COUNT 000 TO 999 ON 7 SEGMENT DISPLAY with 8051 
ANODE ON PORT 1,PORT 2 AND PORT 3
******************************************************/
#include<reg51.h>

sfr a=0x90;   // port P1
sfr b=0xa0;   // PORT P2
sfr c=0xb0;   // PORT P3

unsigned int m,n;  // initialize m,n as a variable

void delay();       // delay 

int ar[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}; // data of common anode

void main()
   {
       unsigned int i,j,k;   // initilize as a variable
       for(i=0;i<10;i++)
         {
             a=ar[i];        // data of ar[i] goes to port P1
             for(j=0;j<10;j++)
               {
                    b=ar[j];    // data of ar[i] goes to port P2
                    for(k=0;k<10;k++)
                      {
                          c=ar[k];  // data of ar[i] goes to port P3
                          delay();
                      }
               }
         }
    }

void delay()       // delay 
  { 
     for(m=0;m<500;m++)
       for(n=0;n<153;n++);
  }

PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)

download (1)

______________________________________________________________________________________________

Content for the tab VIDEO