#include<reg52.h>
void delay (unsigned int z)
{
int x,y;
for(x=z;x>0;x–)
for(y=114;y>0;y–);
}
sbit we=P2^7;
sbit du=P2^6;
sbit key_s2=P3^0;
const int wanan[7]={0x6f,0x5c,0x5c,0x5e,0x7c,0x6e,0x79};
const int weizhi[7]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf};
int num1=0,num2=0;
void main()
{
while(1)
{
we=1;
P0=weizhi[num1];
we=0;
if(key_s20)
{
delay(30);
if(key_s20)
{
while(!key_s2);
du=1;
P0=wanan[num2];
du=0;
num2++;
num1++;
}
}
}
}