PS/2 Keyboard


If you need to do some serious typing, then consider interfacing a PS/2 type personal computer keyboard to the PIC. Nobody uses these for PCs anymore, meaning you can find them from surplus houses, school auctions or thrift stores for a pittance. I bought the one you see here for $6 from All Electronics several years ago, saving it for raining day. Like today.

This exercise illustrates some of things you can do with such a keyboard. To keep things easy for you, I've written a library unit containing a number of useful commands. There's even provision for controlling the LEDs on the PS/2 keyboard, making this a two-way street. I've also thrown in an include file with all of the keycode data.

The hardware is trivial:


When I tested this, I used a breakout board for the 6-pin DIN connector (which is part of the PS/2 keyboard standard). This made it easy to hook things up on the breadboard. I found this little guy at Sparkfun Electronics:


The demo simply accepts keystrokes and mimics them to the LCD. You can use upper- and lower-case letters, and also make corrections with the backspace key, among other things.

As always, you'll want to peruse the source code for additional details. I've documented the hell out of it to be almost standalone.

Click to get the source code.
Click to get the schematic PDF.

Next Project: Reading Potentiometers

No comments:

Post a Comment