亚洲春色中文字幕久久久-三上亚,一吻二脱三床四吻胸,国产真实伦对白视频全集,在线毛片观看,精品成品入口黄网,国产毛aⅴ片久久久,亚洲AV色香蕉一区二区三区老师,萧皇后A级艳片,色情日本视频更新,99久久亚洲精品日本无码
標(biāo)題:
一個(gè)簡(jiǎn)單的51單片機(jī)與鍵盤(pán)通訊的測(cè)試小程序
[打印本頁(yè)]
作者:
oldspring
時(shí)間:
2018-12-4 14:44
標(biāo)題:
一個(gè)簡(jiǎn)單的51單片機(jī)與鍵盤(pán)通訊的測(cè)試小程序
這里介紹一個(gè)簡(jiǎn)單的51單片機(jī)與鍵盤(pán)通訊的測(cè)試小程序,它同樣可以用在 4x1, 4x2 或者 4x3 Keypad 上。希望對(duì)大家有用。(這個(gè)小程序是將鍵盤(pán)上的鍵碼通過(guò)PS2接口,由51單片機(jī)的串行接口輸出,進(jìn)行測(cè)試。)
unsigned short keydata = 0, special = 0, down = 0;
// PS2 module connections
sbit PS2_DATA at P0_0_bit;
sbit PS2_CLOCK at P0_1_bit;
// End PS2 module connections
void main() {
UART1_Init(4800); // Initialize UART module at 4800 bps
Ps2_Config(); // Initialize PS/2 Keyboard
Delay_ms(100); // Wait for keyboard to finish
UART1_Write_Text("Ready");
UART1_Write(10); // Line Feed
UART1_Write(13); // Carriage return
do {
if (Ps2_Key_Read(&keydata, &special, &down)) {
if (down && (keydata == 16)) {// Backspace
UART1_Write(0x08);
}
else if (down && (keydata == 13)) {// Enter
UART1_Write('r'); // send carriage return to usart terminal
//Usart_Write('n'); // uncomment this line if usart terminal also expects line feed
// for new line transition
}
else if (down && !special && keydata) {
UART1_Write(keydata);
}
}
Delay_ms(10); // debounce
} while (1);
}
復(fù)制代碼
相關(guān)信息:
http://www.denmoz.com/bbs/dpj-136722-1.html
PS2.jpg
(38.71 KB, 下載次數(shù): 60)
下載附件
2018-12-4 14:38 上傳
歡迎光臨 (http://www.denmoz.com/bbs/)
Powered by Discuz! X3.1