en.radzio.dxp.pl |
|
Main menu Tutorials Code library for LCD
ATMEL AVR microcontrollers STMicro ST7 microcontrollers Projects Software
|
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 :
|
(c) Radosław Kwiecień |