Monday 3 September 2018

8051: Seven Segment Single Interface Code


Description:
            Seven segment single display which the integer values display from 0 to 9 using the hexadecimal values in for loop, the values will display on the seven segment in port2.In seven segment there is two display in circuit diagram the values display in the first.

Code:
#include<reg51.h>
void delay(int n)
{
            int i,j;
            for(i=0;i<n;i++)
              for(j=0;j<100;j++);
}
void main()
{
            int a[10]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6},i;
            while(1)
            {
                        for(i=0;i<10;i++)
                        {
                                    P2=a[i];
                          delay(600);
                        }
            }
}



Circuit Diagram:



No comments:

Post a Comment