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

3 comments:

  1. Thanks a lot for sharing all those nice examples. They have made jumping in very easy. PMP is a nice programming environment. I used to program in Turbo Pascal long ago, so everything looks familiar to me.
    Just a question about exercise 47: it's driving me crazy. I get the initial message on the LCD but no response from the keystrokes. Since I didn't have any 16F88 in hand, I'm using a 16F628A with a 4Mhz ceramic resonator. Everything looks fine, your example compiles okay but no answer from the keyboard. I've checked the power and signals from the keyboard with a logic probe and when I press a key there is a pulse stream on both data and clock. I tried to swap clock and data with no improvement. Do you think the different processor could be the cause?.
    Kind regards.
    Jes.

    ReplyDelete
    Replies
    1. (Answering to myself :O) )
      It seems that 4Mhz is not enough for this application. I've read somewhere that it needs at least 6Mhz, so I'll try with a 20Mhz xtal and will get back with the results.

      Delete
  2. Pic Projects In Pascal: Ps/2 Keyboard >>>>> Download Now

    >>>>> Download Full

    Pic Projects In Pascal: Ps/2 Keyboard >>>>> Download LINK

    >>>>> Download Now

    Pic Projects In Pascal: Ps/2 Keyboard >>>>> Download Full

    >>>>> Download LINK S4

    ReplyDelete