51單片機的鍵盤掃描程序
特點:按鍵在松手後有(yǒu)效,靈敏度高(gāo),消耗資源少(shǎo),運行(xíng)效率高(gāo)獨立鍵盤為(wèi):K01=P2^4;K02=P2^5;K03=P2^6;K04=P2^7;矩陣鍵盤為(wèi):行(xíng)(上(shàng)到下)_P2.3_P2.2_P2.1_P2.0列(左到右)_P2.7_P2.6_P2.5_P2.4提供的操作(zuò)函數(shù)://獨立鍵盤.無按鍵動作(zuò)時(shí)其返回值num_key=0,否則返回按鍵号num_keyexternunsignedcharkeybo