void keyscan()
{
uchar temp;//
P3 = 0xf0;
temp=(P3 & 0xf0);
if(temp != 0xf0)//
{
delay(5);//
temp=P3 & 0xf0;
if(temp != 0xf0)//
{
P3 = temp | 0x0f;
keyvalue = P3;//
while((P3 = temp | 0x0f) == keyvalue);//
}
}
}
不用变量temp时,直接if(p3 & 0xf0 != 0xf0),检测不了矩阵键盘按下是什么原因呢?
|