unsigned char kbscan() { unsigned char sccode,recode; P1=0xf0; //发全“0”行扫描,列线输入 if(P1&0xf0)!=0xf0) //有键按下 { delay10ms(); //延时去抖动 if((P1&0xf0)!=0xf0) { sccode =0xf0; //逐行扫描初值 while((sccodeZ&0x10)!=0) { P1=sccode; //输出行扫描码 if((P1&0XF0)!=0XF0) //本行有键按下