#include<reg51.h>
sbit a=P3^0; // to on off seven segment
sbit b=P3^1; // " " " " " (same as above)
void main()
{
unsigned char ar[]={0x3F,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned int i,j,k;
while(1)
{
for(i=0;i<100;i++)
{
for(j=0;j<30;j++)
{
a=0; // on the 7 seg at tenth place
b=1; // off the 7 seg at ones place
P2=ar[i/10]; // sending 0-9 to port 2 to 7 seg
for(k=0;k<1275;k++); // delay
a=1; // off 7 seg at tenth place
b=0; // on seven seg at ones place
P2=ar[i%10];
for(k=0;k<1275;k++); // delay
}
for(k=0;k<30000;k++); // large delay for increment of number at ones place
}
}
}