#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
sbit S1=P1^4;
void delay1ms(uint ms)
{
uchar t;
while(ms--)
{
for(t=0;t<115;t++);
}
}
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xbf};
void display(uchar x)
P0=table[x];
P2=0xfb;
P0=table[x/100];
delay(10);
P2=0xfd;
P0=table[x%100/10];
delay(10);
P2=0xfe;
P0=table[x/10];
delay(10);
void main(void)
{
display(11);
while(1)
{
if(S1==0)
{
delay(10);
if(S1==0)
{
x++;
if(x==100)
{
x=11;
}
while(!S1);
}
}
display(x);
}
}