嗯,是的。这是我通过的程序,反转是分先后的,按键的两边是不一样的。
void Read_Key() interrupt 0
{
unsigned char Key_1,Key_2,Key;
unsigned char i;
Buzz_Start();
P1=0x0F;
if(P1!=0x0F)
{
Delay();
if(P1!=0x0F)
{
Key_1=P1&0x0F;
}
}
P1=0xF0;
if(P1!=0xF0)
{
Delay();
if(P1!=0xF0)
{
Key_2=P1&0xF0;
}
}
Key=Key_1|Key_2;
for(i=0;i<10;i++)
{
if(Key==Key_Code[i])
{
WDat(Num_TAB[i]);
}
}
while((P1&0xF0)!=0xF0);
Buzz_Stop();
} |