Miscellaneous › Others › code for 7-segment display as a stot watch by Divya Bharat › Program to interface single
February 11, 2013 at 11:45 am
#9116
umar farrok
Participant
Program to interface single seven segment
#include<reg51.h>
delay_ms(int time) // Time delay function
{
int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}
void main()
{
char num[]={0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0xF8,0x00,0x10}; // Hex values corresponding to digits 0 to 9
int c;
while(1)
{
for(c=0;c<10;c++)
{
P2=num[c];
delay_ms(200);
}
}
}