So Close...

Published Friday, July 12 2013


I’m frustratingly close to getting data from the keyboard, but something is clearly not right.

The keyboard protocol is weirder and weirder the more you look into it. Long story short, the terminal is continuously sending a status word to the keyboard, as previously discussed When it wants to read the current key (or keys) being pressed, it sets bit 5 in the status word, and the keyboard responds by scanning every single key on the keyboard in sequence. Whenever it finds a key down, it sends the key code to the terminal, and then continues its scan. When it’s done with its scan, it sends the character code 0x7F to say “I’m done!”

Not a design decision I would have made, but whatever.

Anyway, I’m trying my best to get the Teensy 2.0 to emulate this behavior. It’s constantly sending status bytes to the keyboard. My demo program clearly shows the status bytes are working, I can control all the lights and the speaker. Once every 64 status bytes, I ask for a key scan. The UART receives the data, and interrupts the Teensy to let it know it has data available. That’s all working fine.

In fact, I can successfully read character codes, but only some of them. A lot of them just don’t work at all, and others send back weird (but consistent, at least) values that they shouldn’t.

Just to be absolutely sure it’s not a bad keyboard, I finally dug my VT101 out of storage and turned it on for the first time (carefully, with a Variac). Hey, good news, it works perfectly. No issues. The keyboard is 100% functional on a real VT100 terminal. That is actually a big relief.

So, I’ll keep plugging away. Debugging is the fun part, right?!