Friday, 30 December 2016

Counting numbers from 0 to 99 using 7 segment display

Hi friends, In this writeup we will be explaining  how to count numbers from 0 to 99 by using seven segment display and will be showing it practically using proteus software. 


Hardware Implementation:- 

   The hardware components used  are 7 segment segment display and 8051 microcontroller. A seven segment display having a 8 diodes and one anode or cathode pin to display numbers from 0 to 9 and  there are two types common cathode and common anode. In common cathode we are connecting to the ground and in common anode we are connecting to the vcc. These is a seven segment display






The basic architecture of a seven segment display is shown below
  



The software implementation is mainly depends on the type of display chosen 





                  COMMON ANODE                                                 COMMON CATHODE






Hardware connection in proteus:





                                                                                                                                                                   

Software implementation:- (copy these code into keil uvision software and create HEX file)         

  #include<reg51.h>
   void delay(int a)
    {    unsigned int i,j;
          for(i=0;i<a;i++)
          for(j=0;j<=1000;j++);
       }
   void main()
      {
            char b[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
             int i,j;
             P2=0x00;
             P3=0x00;
             while(1)
                  {
                         for(i=0;i<=9;i++)
                                {
                                       P2=b[i];
                               for(j=0;j<=9;j++)
                                         {
                                                   P3=b[j];
                                                   delay(100);
                                          }
                                  }
                          }
 
               }

                                                       


No comments:

Post a Comment