#include
//定义开关
sbit k1=P1^0;
sbit k2=P1^1;
sbit k3=P1^2;
sbit k4=P1^3;
sbit k5=P1^4;
sbit k6=P1^5;
sbit k7=P1^6;
sbit k8=P1^7;
sbit k9=P3^0;
sbit k10=P3^1;
void delay()
{
unsigned char i,j,k;
for(i=10;i>0;i--)
for(j=200;j>0;j--)
for(k=10;k>0;k--);
}
void M()
{
P2=0xFe;delay();P2=0xFd;delay();P2=0xFb;delay();P2=0xF7;delay();
P2=0xeF;delay();P2=0xdF;delay();P2=0xbF;delay();P2=0x7F;delay();
}
void N()
{
P2=0x7F;delay();P2=0xbF;delay();P2=0xdF;delay();P2=0xeF;delay();
P2=0xF7;delay(); P2=0xFb;delay(); P2=0xFd;delay();P2=0xFe;delay();
}
void main()
{
while(1)
{
if(k9==0) M();
if(k10==0) N();
if(k1==0) P2=0xfe;
else if(k2==0) P2=0xfd;
else if(k3==0) P2=0xfb;
else if(k4==0) P2=0xf7;
else if(k5==0) P2=0xef;
else if(k6==0) P2=0xdf;
else if(k7==0) P2=0xbf;
else if(k8==0) P2=0x7f;
else P2=0xff;
}
}