unsigned l,h,key;
P1=0xff;
while(1)
{
P2=0xf0;
l=P2;
l=l&0xf0;
if(l!=0xf0)
{
delay(200);
if(l!=0xf0)
{
l=P2&0xf0;
l=l|0x0f;
P2=l;
h=P2;
h=h&0x0f;
l=l&0xf0;
key=l+h;
}
}
switch(key)
{
case 0xee:P1=smg[0];break;
case 0xde:P1=smg[1];break;
case 0xbe:P1=smg[2];break;
case 0x7e:P1=smg[3];break;
case 0xed:P1=smg[4];break;
case 0xdd:P1=smg[5];break;
case 0xbd:P1=smg[6];break;
case 0x7d:P1=smg[7];break;
case 0xeb:P1=smg[8];break;
case 0xdb:P1=smg[9];break;
case 0xbb:P1=smg[10];break;
case 0x7b:P1=smg[11];break;
case 0xe7:P1=smg[12];break;
case 0xd7:P1=smg[13];break;
case 0xb7:P1=smg[14];break;
case 0x77:P1=smg[15];break;
}
}
}
c: 16键.zip