A friend of mine bought a really old 122 key Memorex telex keyboard at somewhat of a mysterious place, it was really dirty and probably used a lot but it looked very cool. He cleaned it very thoroughly up to the point where it looked almost brand new, hooked it up to his computer and…. nothing. This was somewhat disappointing.
He asked if I could take a look at it because people seem to think I know a lot about electronics, but he was not expecting much. I had a hunch that the keyboard used the old XT keyboard protocol, which does not work on modern AT style computers.
So I hooked the keyboard up to a 5 volts power supply and pressed numlock, this turned on the numlock light, which makes sense because the XT keyboard protocol only goes one way, the pc has no way of commonicating with the keyboard, so the keyboard has to turn on the lights by itself.
Next I hooked up the data pin to the scope and lo and behold, it actually did something:
The protocol looked somewhat like 9600 bps rs232, but it has two start bits and no stop bits, so I hooked it up to the rx pin of the serial port and wrote a little program to show on screen what data the keyboard was sending.
This worked somewhat but not to my satisfaction, the timing was slightly off so I was unable to properly read the most significant bit, which represents whether a key is pressed or released.
The solution was to use a 16F84A microcontroller to translate the data to proper rs232, since the keyboard works with ttl levels I could hook up the data and clock pins directly to the microcontroller’s ports.
This looks surprisingly simple, and it is, the keyboard’s data pin connects directly to pin B1 which is programmed to be an input, the clock pin connects to pin B0 with a pull-up resistor and pin B2 connects directly to the rs232 rx pin, no level shifter is used for rs232 since most (probably all) rs232 ports can handle ttl levels (and I didn’t feel like soldering).
The microcontroller sits in an endless loop, first it makes pin B0 an input to signal the keyboard that it can send data, it then waits for pin B1 to become high, and when it does it waits about 2,5 bits, the reason for this is so it reads the data in the middle of the bits.
It then reads the first databit, waits one bit, reads the second databit etc.
I tried using the clock pin as a clock source, but I saw very strange behaviour when I did that, so I decided to use normal delays in the controller.
This of course makes the controller incompatible with other XT protocol keyboards. Also the keyboard is connected to 5 volts and ground, which I forgot to include in the schematic.
Visit Here for more.