Hacked Gadgets Forum

September 28, 2009

How to connect a a PS/2 Keyboard to a Microcontroller

at 2:54 pm. Filed under DIY Hacks, Electronic Hacks

 

Connecting a keyboard to a microcontroller project could be a useful addition. Even if it is to be used as a code input device it could be more convenient than using a key matrix. The guys over at Nerd Kits have put together an informative video that is based on the NerdKit however it is applicable to any microcontroller.

"The PS/2 Interface is quite easy to implement. To send a key stroke, the keyboard begins driving the clock line. On the falling edge of the clock line, the data line represents the current bit. Each keystroke is sent as 11 bits: first a start bit of 0, then the 8 bits of the scan code (least significant bit first), then a parity bit (odd parity, which we did not implement for simplicity’s sake), and finally a stop bit (always 1)."