unsigned char GetKey(void)
{
unsigned char KeyTemp,CheckValue,Key = 0x00;
CheckValue = P2&0x32 //&运算用来保留位数,如P2&0x0f,即保留有1的低四位。
if(CheckValue==0x32) //而1运算则用来
return 0x00;
Delay1ms(10);
KeyTemp = P2&0x32;
if(KeyTemp==CheckValue)
return 0x00;
if(!(CheckValue&0x02))
Key|=0x01; //
if(!(CheckValue&0x10))
Key|=0x02;
if(!(CheckValue&0x20))
Key|=0x04;
return Key;
}
读不懂这段代码的意思,大家可以指点一下吗?
|