Help with keyboard matrix for Commodore 128D

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.

Thanks

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.

Well, that's the issue at the moment. I want to simulate a keypress from the Arduino without an actual keyboard to read at the moment.

So I would load up a sketch to "virtually" type "go 64 y", for example.

When that works, I want to then find a real keyboard and start reading it.

Hope that makes sense.

Thanks.

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.

Hope that makes sense.

Makes perfect sense. I assume you can't understand my answer.

If there is some aspect you don't understand then ask about it. I provided you with one solution, one that uses no external hardware chips.

Grumpy_Mike:
Makes perfect sense. I assume you can't understand my answer.

If there is some aspect you don't understand then ask about it. I provided you with one solution, one that uses no external hardware chips.

Well, yeah...I'm able to understand your answer. But your answer didn't work. :slight_smile:

No worries, though. Thanks for the suggestion.

But your answer didn’t work. :slight_smile:

Then you did not implement it correctly.

Post a schematic and the code of what you tried.

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.

Did anyone ever get this sorted? I'ld like to used and Arduino to hook up a USB keyboard to a 128D.

As there was no response to the solution in #7, I think that nobody tried it. IMO the 4051 solution should work.

With the USB keyboard you'll need an Arduino that can act as a USB master. It may be cheaper to get a PS/2 keyboard than such an Arduino.