I have a Commodore 128 D that is missing the external keyboard. And they are very hard to locate.
So, I thought I would build a circuit that could emulate a keyboard.
The C128D has a 25 pin parallel keyboard connector. Of those, 23 pins are devoted to its matrix.
It has 8 pins for ROWS, 8 pins for COLUMNS, 3 pins for EXTERNAL KEYPAD and a few control key pins.
When I physically take two wires and connect one to a ROW and another to a COLUMN, I can get the character I want on screen. Holding the wires together is like holding the key down.
What I want to do is eventually read a PS/2 (or USB) keyboard and translate the keys to the C128D matrix. But for now, I just want to send a stream of characters over and use the serial monitor as my virtual keyboard.
I've tried to replicate this with an Arduino UNO using just two pins but cannot get it to work.
The idea was to see if I could get the same character using the same wires as before. For example, connecting UNO pin 2 to UNO pin 3 to simulate C128D ROW/COL pins connecting.
I've tried different combinations of ROW being HIGH/LOW, COL being HIGH/LOW, etc. I can get some random characters on screen but never the exact ones I want.
I realize the UNO doesn't have near the pins needed for a complete keyboard but I thought if I could get one "proof of concept" to work, I could use some shift registers for all the pins.
Any idea on how I can tackle this? What I need is some type of "switch board operator" circuit to connect any column to any row.
You need to see which are the outputs and which are the inputs of the columns and rows. Then you need to read the outputs of your keyboard with some inputs to the Arduino, and when a certain pattern ( or number ) occurs then set the appropriate keyboard input to be active with an Arduino output. This could be a high or low depending on how they designed it. When you do this it will be the same as holding a key down.
The Commodore is probably trying to scan the keyboard matrix. That is, one of the column lines* is activated and it looks to see if that signal is on one of the row lines*. If it is not then "no key" is pressed and if it is, then that maps to a particular key.
What you need to do is detect when the column line* is activated and drive the appropriate row line* to get the desired character.
*I've assumed above that column is "output" and row is "input", but it could be the reverse. Probing with an oscilloscope would show which is the case and what is the "active" level.
The easiest way to emulate a matrix is to use two 8-way (or whatever) multiplexers such as the 74HC4051 back-to-back.
Using a microcontroller to read the scanning on one set of inputs and reply with the correct output on another set, as fast as required, is not very practical. The tandem multiplexers require only seven control pins to be set for the static time corresponding to a manual press.