按键扫描
unsigned char Trg,cont,num;
void key_sm(void) { uchar Read; Read=P0^0xff; Trg=Read&(Read^cont); cont=Read; }
void key_hs()
{
switch(Trg)
{
case 0x01:
num++;
break;
case 0x02:
num--;
break;
default:
break;
}
}