• Please review our updated Terms and Rules here

PS/2 to parallel keyboard project

Dwight Elvey

Veteran Member
Joined
Jun 21, 2003
Messages
4,995
Location
Santa Cruz
I'd earlier stated that it would not be too big a deal to convert the output of a PS/2 keyboard to a parallel for older computers, now that keyboards were getting rare.
It turns out that it is not as simple as I'd thought going in. Making a PS/2 to XT looks to be relatively trivial.
I've put about 15 hours into this so far an looks like I'm on the home stretch.

Here is a list of "I gotchyas":
1. First, most of the stuff on the web says that 1Ch translates to 'A'. Actually, if you think about it, it translates to 'a', not 'A'.
2. You need to read strings of data continuously. This means you really need a FIFO. If a character does not have a stop bit = 1 it means it isn't done yet. You have more to buffer up.
3. You need to give careful thought about which special keys have precedence over other keys.
a. Control key takes over only letters. I've included ` in this because I know the System88 of the Polymorphic 8813 editor expect there to be a 00h from the keyboard.
b. CapsLock only effect letters
c. Shift effects others that are not simple ANDing with 6Fh, like letters.
4. Control and Shift keys also generate repeats ( not sure why ) but entering an effected key stops the repeats ( what if I wanted a repeated control character )?
5. What to do with the rest of the keys. F keys, number pad keys, arrow keys, and newer ones have a number of short cut keys along the top. Right now, I'm just ignoring them but maybe I should be doing something with them, at least the number keys and maybe the arrow keys? What to do with smaller keyboards that don't have separate arrow and number keys? The Window key?? Other keys???
6. Now simpler stuff, turning on LEDs, selecting auto repeat, repeat speed, number pat lock and on.
7. Even the parallel port needs a special select for the polarity of the strobe.

I wanted the project to be simple. It is more than I'd thought up front. Not to serious though. I'm well along and now I'm just tidying things up. I wanted it to be cheap. You don't need a special PC board made. A rats nest of point to point wires is all that is needed to the keyboard, power supply ( running mine from USB port right now ) and the parallel out connector. You do need some pullup resistors. I'd used individual resistor and LEDs ( so I could see things happening ) but a simple 4.7K 10 resistor R-pack would be enough. If you want LEDs, you may need to shunt the LED with a 4.7K to get full swing. I run my LEDs with a limiting resistor to 5ma. You just buy a "Blue Pill" ( STM32F103 on a tiny board for about $3 on ebay or elsewhere ) and wire it up. The resistor are because the chip runs at 3.3V but everything we want to connect it to is 5V. The chip has a number of 5V tolerant I/Os.
Now here's another thought that occurred to me this morning. The STM32F103 is running an ARM Forth. I could easily add an "Easter Egg" to drop into Forth. I can make it dual so that the serial, that I use and the keyboard/parallel are both running. I can think of all types of advantages. One could store sequences on the F103 to help in debugging. One could use the serial port for logging and downloading sequences to the old computer. One could even patch the code to change any behavior one wanted and save it to flash. The possibilities are endless. ( the blue pill has a USB end point connector that I don't have any code currently to run but could be added ).
When I get things as I like I'll put the source and a *.HEX file on github.
Any thoughts about the extra keys?
Dwight
 
Last edited:
Dwight, were I to start on this myself, I'd probably use the PC BIOS as a model as to what does what. Certainly, it can give you a set of translation tables. As far as translation of the F-keys and such, well, it's a matter of how you want to do it. You could send out something like VT52 codes (something preceded by an escape sequence) and there's always the option of ignoring certain shift combinations. Bottom line is what the thing will be used for and what's required. I seem to recall that a terminal with CRT display and PS/2 keyboard was done with an ATMEGA8 some years back. A STM32F103 should be as happy as a pig in mud.

Even the little PIC converter I did years ago buffers up keystrokes--and that's with 64 bytes of RAM and less than 2K of ROM.
 
True, but he has kindly made the gerber files and source available, so it's a nice starting point.

I've also built one, and it works nicely.

- Gary

Cute but $3 and a R-pack is much cheaper.
I'm curious as to what Ctrl-Alt-Del means to a machine with a parallel keyboard input. Normally that is trapped by the 8052 or what ever is on the mother board from the serial keys entered.
Dwight
 
True, but he has kindly made the gerber files and source available, so it's a nice starting point.

I've also built one, and it works nicely.

- Gary

He is obviously not in it to make a lot of money. His pricing of the blank boards is about as cheap or cheaper than a single board could be made. He's added a lot of software features that I'll likely not spend as much time on. My point is that the entire thing can today be done for less than the PC board alone. Since it is almost done, I might as well finish it. When done, you have the advantage of a Forth interpreter/compiler to play with as well.
Making it from scratch is most of the fun. It is already operational, I just have to determine what to do with the extra keys, that are not part of a typical parallel keyboard.
Dwight
 
Back
Top