Commodore 64 usb keyboard

 


As I type this the keyboard in my thinkpad t60 is going, so all these keyboard projects are good.  I found that the guy who created the firmware I’m using to interface the ibm 122 key to my computer also developed one that will take a raw matrix and use the same great config file structure to create a usb keyboard.  There are a bunch of options for debouncing, blocking, scanning, and even muxing inputs and outputs to use a matrix larger than the free number of pins on the ’32u4 (or just use the existing hardware in the keyboard).  This project was essentially a proof of concept for my arcade machine keyboard controller so now that this works I can start designing and wiring up the matrix for that.

The first thing I did was get the pinout for the keyboard matrix, then I found that one key is not part of the matrix, so I threw it on one of the rows and made it a new column with undefined keys below it.  Now I have to define a key matrix in the config file, no problem.  I just looked at the documentation, copied an existing config file and went to town.  Some of the keys were in interesting since either the closest key didn’t exist, or I had used it elsewhere I had to use dummy keys.  I chose the “LANG_#” keys since I figured even if one of the keycdes got through the OS would just shrug and forget about it.

The macros I was good at this time around, once I decided what I wanted the keys to do it was just a matter of writing up the commands and bracketing them wit a macroblock.  Enter problem number one, the macroblocks have a fixed length.  I didn’t bother to figure out how many macros could go in one block, I just broke them up into logical blocks and then it worked.

The next one I encountered was that for some reason the PD0 and PD1 pin (arduino D3 and D2) didn’t like being used for scanning.  I don’t know what about them but when I moved to PF1 and PF0 everything went smoother.  For this project I used the olimex-32u4(since the board doesn’t matter, just the mcu) and I decided to cut all the LED jumpers (there are 3) just to be safe.

Now I had a matrix, being read reliably, outputting scancodes more or less properly.  There was still a problem with some keys’ shifted functions not working properly.  I bumped my macro block for the shifted chunk above the general re-maps and that cleared right up.

To sum up the config file: all keys do more-or-less what they say on top.  The odd F-keys are the main buttons, the even ones are done by holding down the commodore key (windows key).  The british pound key is the backslash/pipe key.  My favorite mod was making the “wasd” keys into the arrow keys (since the commodore arrow keys are a mortal sin) using the windows key.

That’ it.  I now have a working commodore 64 keyboard as a usb keyboard.  The project this is for isn’t quite a secret, but despite hackaday’s warning I’m not posting about it just yet.

my config file: here

About these ads

Tags: , , , ,

4 Responses to “Commodore 64 usb keyboard”

  1. D Says:

    Hello Evan, I have a VIC 20 keyboard and was interested in hooking it up to a USB like you have done here with the Commodore 64 keyboard. The VIC 20 keyboard is very similar to the commodore 64 and i was thrilled to find your project here as my previous searching had turned up nothing. I have little to no experience with an arduino but I can solder and code and was wondering if you could give me any suggestions on how to proceed with this project. I was interested in investigation the option of using a modern keyboard logic board and soldering in the pins from the VIC 20 keyboard to replace the ones from a modern keyboard if i could find one with a similar key matrix, then solving the missing/incorrect key assignments software side. Thanks, D

    • abzman2000 Says:

      I would suggest soarer’s key matrix firmware (linked in this article), an arduino micro, and my config file as a starting point. I would say to read the thread on that firmware and make sure you understand how it works then it’s just those components (I think the vic-20 keyboard it the same as the commodore 64’s

  2. Make that C64 Keyboard Work as a USB Keyboard Says:

    […] Let’s face it, we all have keyboard peculiarities. Don’t try to deny it, everyone who types a lot has an opinion of the keyboard they stroke so frequently. We know [Brian Benchoff] swears by his model M, and we’re guessing he was the one that bumped into [Evan] and convinced him to write about his conversion of a Commodore 64 keyboard for use as a USB device. […]

  3. Make that C64 Keyboard Work as a USB Keyboard - Tech key | Techzone | Tech data Says:

    […] Let’s face it, we all have keyboard peculiarities. Don’t try to deny it, everyone who types a lot has an opinion of the keyboard they stroke so frequently. We know [Brian Benchoff] swears by his model M, and we’re guessing he was the one that bumped into [Evan] and convinced him to write about his conversion of a Commodore 64 keyboard for use as a USB device. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: