This project uses a PICAXE 20X2 microcontroller to interface an old style PS2 keyboard with a 2 X 16 LCD. The program is quite lengthy and is probably not perfect but most functions seem to work. Because some special keys use a preceeding $E0 character which the PICAXE Kbin command ignores, I was not able to decode them. This is my second PICAXE project so there are probably more elegant ways to program these functions, this is just the way that I figured out to do it on my own as very much a beginner.
The PICAXE has been programmed to ignore most keys that don't have much use in this application such as the up and down arrow, ALT, esc, break etc keys for example. CAP lock and Shift work. Shift behaves like CAP lock, press down once and it stays on until you press Shift again. It also displays "CAP" or "SHF" at the top right of line 1 to show that the function is active. The 20X2 has been programmed so that when Line 2 of the LCD display is full, pressing the key for any displayed or right cursor moving character will clear the display and return the cursor to start of Line 2. You will then need to press the key again to get it to display. Also I find that this keyboard to LCD interface is not fast. You need to wait about 1/2 sec after each keypress before it is ready to accept another keypress. I did not persue this because I don't need it to be fast, but suspect that this could be made faster by buffering the incoming characters in multiple variables.
The program is included and you will be able to follow how it works by reading the comments which are quite detailed. They are detailed because I left off working on this program for about a month and was totally lost when I came back to it, so I wanted to make sure that did not happen again. You can easily modify this program to use the keys that are currently ignored. Also, it will be fairly obvious to anyone familiar with PICAXE that this program and hardware can be modified so that instead of displaying characters on an LCD, you could control just about anything - relays, servos, logic, lights etc with a keyboard using this kind technique. I will leave it to the ambitious to do that!
Step 1: Parts List
Clear project box (Hammond 1591CTCL - it is a tight fit but works if you place components carefully)
PICAXE 20X2 Microcontroller
16 X 2 LCD - UniQ/eVision GC-1602I1 or equivalent
6 Pin Female mini-DIN to match keyboard connector (Bulkhead)
5V wall wart - SPS10A-001 or equivalent for 5V power supply (e.g. 9V battery and LM7805 regulator)
(You can also use a battery and clip, e.g. 3 x AAA instead of a wall wart - but do not exceed 5V!!)
A jack which matches the power connector on your wall wart
3.5 mm Stereo Jack - Programming connection
PICAXE USB Programming Cable AXE027
2 x 4.7k resistors
Hook up wire
2" x 6" Breadboard or equivalent, PCB to fit in box, Pushbutton latching on/off switch, LM7805 (1A) Voltage Regulator, 0.01 UF 16V capacitor, 4 - 1/4" standoffs, 8 - 4-40 nuts & bolts, 9V battery clip and 9V battery.