#include<reg52.h>
//void delay(unsigned char i);
unsigned char code LED[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
void main()
{
int i=1;
P2=0xff,P0=0xff;
while(1)
{
if(i<1)
{
switch(P2)
{
case 0xfd : P0 = LED[1],i++;break;
case 0xfb : P0 = LED[2],i++;break;
case 0xf7 : P0 = LED[3],i++;break;
case 0xef : P0 = LED[4],i++;break;
case 0xdf : P0 = LED[5],i++;break;
case 0xbf : P0 = LED[6],i++;break;
case 0x7f : P0 = LED[7],i++;break;
default:break;
}
}
if(P2==0xfe)
{
i=0;
P0 = 0xff;
}
}
}
/*void delay(unsigned char i)
{
unsigned char j,k;
for(j=0;j<255;j++)
for(k=0;k<i;k++)
;
}*/
//void delay(unsigned char i);
unsigned char code LED[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
void main()
{
int i=1;
P2=0xff,P0=0xff;
while(1)
{
if(i<1)
{
switch(P2)
{
case 0xfd : P0 = LED[1],i++;break;
case 0xfb : P0 = LED[2],i++;break;
case 0xf7 : P0 = LED[3],i++;break;
case 0xef : P0 = LED[4],i++;break;
case 0xdf : P0 = LED[5],i++;break;
case 0xbf : P0 = LED[6],i++;break;
case 0x7f : P0 = LED[7],i++;break;
default:break;
}
}
if(P2==0xfe)
{
i=0;
P0 = 0xff;
}
}
}
/*void delay(unsigned char i)
{
unsigned char j,k;
for(j=0;j<255;j++)
for(k=0;k<i;k++)
;
}*/