#include
unsigned char c,i,k,p;
sbit p10=P1^0;
unsigned char s[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
main()
{unsigned char key1,key2;
unsigned char i,k;
void delay();
void delay2();
unsigned char getkey();
while(1){
delay2();//消除程序履行太快 引起的屡次判别
key1=0;key2=0;
key1=getkey();
if(key1==0) continue;//没有键按下 持续循环检测
delay();
key2=getkey();
if(key1==key2) {P2=s[i];P3=s[k];k++;if(k==10) {k=0;i++;if(i==10)i=0;}}
void delay()
{unsigned char a,b;
for(a=20;a>0;a–)
for(b=248;b>0;b–)
{}
}
unsigned char getkey()
{if(p10==0) {return 1;}
else return 0;}
void delay2()
{unsigned char a,b,c;
for(c=20;c>0;c–)
for(b=248;b>0;b–)
{}}