PS/2 to PCjr Keyboard Converter - Schematic and Source

Hardware questions and modifications

PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Wed Apr 08, 2015 6:18 pm

I thought people might get lost getting to the end of the other thread, so I made this new one.

UPDATE (4/18):
I've just uploaded my PS/2 to PCjr Keyboard Converter source code to an SVN repository:

https://www.assembla.com/code/ps2pcjr-1 ... sion/nodes

The new code runs on a 12F617 rather than a 16F88, so the schematic below is not valid for the current SVN code. (UPDATE: The 12F617 version of the schematic has been uploaded to the SVN repository as a PDF inside the project directory.) And for those of you who haven't read this thread yet: I have ordered enough parts to make about 10 PCBs for this project, including a shielded cable with the proper connector to connect to the PCjr. The plan is to sell completed boards for $25 apiece plus shipping. I'll post an update when they're ready for purchase.


Schematic (Updated 4/9):
PS2PCJr.sch.png
(70.82 KiB) Not downloaded yet


Source code (Updated 4/9):
PS2PCjr_C_Rev4.X.zip
(239.05 KiB) Downloaded 183 times
Last edited by jmetal88 on Sun Apr 19, 2015 8:27 am, edited 6 times in total.
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Wed Apr 08, 2015 8:00 pm

Ah, I just came up with a fix that lets PAUSE and PRINT SCREEN work. Basically before I run the translation routine, I take note of the write position of the PS/2 read buffer, then delay 5 ms. If the write position is the same after the delay as it was before it, run the rest of the routine and send translations for everything that's been buffered. With PAUSE and PRINT SCREEN, the write position always gets increased on the next scan code before the delay expires. It is worth noting that this works for ONE keyboard I have tried, though, and since not all PS/2 keyboards are identical in timing, it may require some further adjustment (I am tempted to make it 10 ms before uploading anyway, and I may go ahead and do that).

EDIT: Eh, I went ahead and uploaded the 5 ms version. If anyone tries it and thinks it needs to be changed, let me know.

Also, if anyone thinks I should put together more of a production type device (PCBs and whatnot) this would be the place to ask for it. It's a really simple circuit you can put together on a piece of perfboard, but I can understand if you don't want something homemade-looking sticking out the back of your PCjr or if you just don't want to solder the thing together yourself.
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Thu Apr 09, 2015 10:55 am

Testing this out further today, it does still appear to need some minor timing adjustments. Most of the time, keys get translated over just fine, but occasionally the PCjr will miss a key and let you know with its characteristic missed key beep. There is one recommended thing to do with the PS/2 read timing that I omitted in my code which may help, and it may also help to adjust the timer preset in the output routine.
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Thu Apr 09, 2015 3:48 pm

It took a lot of tries, but I finally got the communication inhibit during write to the PCjr taken care of. New version is not ready for upload yet (I want to test it further first) but you'll know it's up when you see the revision version changed to Rev 4 in the main post.

EDIT: Its up.
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Thu Apr 09, 2015 6:39 pm

You know, I wonder if something as simple as changing to an external oscillator would help? I'm using the internal oscillator for my circuit, which AFAIK is just an R/C oscillator with some tuning circuitry. It might be unstable enough to mess with my output randomly.

EDIT: No, I looked at the data sheet and the internal oscillator and the internal R/C oscillator are two different circuits. So there might not be much I can do about the instability over time. I'm still thinking about possibly trying to port this to a smaller/cheaper PIC, but since that would involve me buying more parts, I'm not sure I want to.
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jharre » Thu Apr 09, 2015 8:59 pm

Yep! We're still watching this saga. :D

I'll have to check and see if my burner programs PIC chips. It probably does, but it hasn't been out of the box for a while.

What are you using to compile the code? Is it freely available?
jharre
 
Posts: 61
Joined: Tue Jun 18, 2013 9:48 pm
Location: Placitas, New Mexico

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Fri Apr 10, 2015 7:06 am

It's an MPLAB X IDE project, which you can download from Microchip for free. It's using the free version of their XC8 compiler (they have a paid version that's supposed to be 'smarter', but I haven't tried it yet). So if you want to compile it yourself, download MPLAB X and XC8 and install them both, then unzip the folder and open it as a project in MPLAB X. There should be a binary in there as well, if you just want to upload it to a PIC16F88 and try it without compiling it (I believe it's the .hex file in /dist/default/production).
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Fri Apr 10, 2015 3:44 pm

I just took a short video of the device working. I discovered a new problem in the process that apparently my microcontroller is resetting while idle and missing the first keystroke due to the code I put in to avoid the power-up issue, so I think I need to change the code from ignoring whatever the first code is to specifically ignoring the 0xAA BAT code. I'm going to try to upload the video to Youtube soon, but my phone's orientation sensor screwed up and thought it was taking a vertical video so I've got to wait for this app I downloaded to rotate the video for me.

EDIT: The app rotated the video on my phone, but when I tried to upload it to Youtube it rotated back, so I'm going to have to do this on my computer instead. Hang on...
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Fri Apr 10, 2015 4:44 pm

Alright, it's a terrible video, but here it is.

https://www.youtube.com/watch?v=RXH-btRVsZk
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Re: PS/2 to PCjr Keyboard Converter - Schematic and Source

Postby jmetal88 » Sat Apr 11, 2015 8:50 am

I think I definitely want to re-work this with an external oscillator. I suspect both internal oscillators on the PIC are R/C oscillators, even though the data sheet only explicitly specifies the secondary oscillator is.

Unfortunately, all I have is a bag of 24 MHz crystals, and the fastest this PIC can run is 20MHz, which means I'll have to order some new parts (I have a couple of spare PIC18F23k22 chips it would probably work with, but I thought the 16F88 was overkill for this project, so the 18F23k22 would be way overkill, even though it is somehow a slightly cheaper chip).
jmetal88
 
Posts: 793
Joined: Sun Jul 25, 2010 10:22 am

Next

Return to PCjr Hardware

Who is online

Users browsing this forum: No registered users and 1 guest