本帖最后由 hceng 于 2013-12-17 22:55 编辑
#define BIT1 0x01
#define BIT2 0x02
#define KeyShuIO P1
KeyShuIO=0xfe;
while(KeyShuIO&0x20!=0)
{
if(~KeyHenIO&BIT1){KeyCurrent|=BIT1+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT2){KeyCurrent|=BIT2+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT3){KeyCurrent|=BIT3+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT4){KeyCurrent|=BIT4+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT5){KeyCurrent|=BIT5+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT6){KeyCurrent|=BIT6+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT7){KeyCurrent|=BIT7+(~KeyShuIO)<<8;}
if(~KeyHenIO&BIT8){KeyCurrent|=BIT8+(~KeyShuIO)<<8;}
KeyShuIO=KeyShuIO<<1|0x01;
}
|