unsigned char GetKey(void)
{
unsigned char KeyTemp,CheckValue,Key = 0x00;
CheckValue = P2&0x32 //&運算用來保留位數(shù),如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;
}
讀不懂這段代碼的意思,大家可以指點一下嗎?
|