|
|
Interfacing PC keyboard to microcontroller |
|
Typical computer keyboard with PS2 can be easy connected to
microcontroller system. On this page I show an example of connecting PC
keyboard to Atmel AVR MCU. Example software is written in C language and
can be compiled in avr-gcc compiler. Pinout of PS2 keyboard connector :
Data between keyboard and computer is transmitting by two wire synchronous interface (CLK and DATA lines). If data are transmitted from keyboard, clock signal is generated by keyboard. Frequency of this signal is between 20 and 30 kHz (this is not standard). Data frame consist with start bit, eight data bits, parity bit and stop bit.
Reading data is easier realized in interrupts from falling edge on CLK line. Schematic of interfacing keyboard to MCU :
Example program which read pressed key scan code for AVR microcontroller (ATMega16). Download file : atkeyboard.h atkeyboard.c scancodes.h
See also : Interfacing T6963 based LCD to AVR MCU
|
Last modification :
17-07-2008 19:07:20
(c) Radosław Kwiecień
Privacy policy