本帖最后由 huo_hu 于 2017-11-13 21:32 编辑
file:///C:/Users/huzi/AppData/Local/Temp/msohtmlclip1/01/clip_image002.jpg
unsigned char Get_Key_Status (void) { unsigned char i,ret=0,line=0; for (i=1;i<16;i<<=1){ //1,2,4,8 P1=(P1&0xf0)|~i; //P1列i取反输出 line =(~P1& 0xf0); //取高四位行值 if (line >0) //P1口高四位不全1有键按下 ret |= (line+i); //当前行值和列值累加 } return ret; }//end fun
|