include <REGX52.H>
sbit C1=P1^3;
sbit C2=P1^2;
sbit C3=P1^1;
sbit C4=P1^0;
sbit L1=P1^7;
sbit L2=P1^6;
sbit L3=P1^5;
sbit L4=P1^4;
void delay(int time)//????
{
unsigned int i,j,y;
for(y=0;y<time;y++)
{
for(i=0;i<19601;i++)
{
for(j=5;j>0;j--);
}
}
}
unsigned char Lie,column;
unsigned char C(){
if(C1==0){delay(0.02);while(C1==0);delay(0.02);column=1;}
if(C2==0){delay(0.02);while(C2==0);delay(0.02);column=2;}
if(C3==0){delay(0.02);while(C3==0);delay(0.02);column=3;}
if(C4==0){delay(0.02);while(C4==0);delay(0.02);column=4;}
return column;
}
unsigned char L(){
if(L1==0){delay(0.02);while(L1==0);delay(0.02);Lie=1;}
if(L2==0){delay(0.02);while(L2==0);delay(0.02);Lie=2;}
if(L3==0){delay(0.02);while(L3==0);delay(0.02);Lie=3;}
if(L4==0){delay(0.02);while(L4==0);delay(0.02);Lie=4;}
return Lie;
}
void main(){
while(1){
Lie=L();
column=C();
if(Lie){if(column1){if(Lie1){P2_0=0;}}}
}
}