#include<reg51.h>
#define uint unsigned int
sbit k1=P1^4;
sbit k2=P1^5;
sbit k3=P1^6;
sbit k4=P1^7;
sbit k5=P3^2;
sbit k6=P3^3;
uint c;
void delay(uint);
void main()
{while(1)
{if(k4==0)
{delay(10);
if(k4==0)
{c=1;
P2=0x7f;
P0=0xc0;
while(!k4);
}}
if(c==1)
{if(k1==0)
{P2=0x7f;
P0=0xf9;
c=0;
}
if(k2==0)
{P2=0x7f;
P0=0xa4;
c=0;
}
if(k3==0)
{P2=0x7f;
P0=0xb0;
c=0;
}
if(k5==0)
{P2=0x7f;
P0=0x99;
c=0;
}
if(k6==0)
{P2=0x7f;
P0=0x92;
c=0;
}}}}
void delay(uint x)
{uint i,j;
for(j=x;j>0;j--)
for(i=110;i>0;i--);}
|