PS/2 to PCjr Keyboard Converter - Schematic and Source

Hardware questions and modifications
MikeModified
Posts: 136
Joined: Sat Mar 15, 2014 5:10 pm
Location: Portland, OR

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

Post by MikeModified »

jharre wrote:
Yay! Kudos to Mike - he beat me to it.

<*> Jim
As long as he remembers, when he's rich and famous, who gave him his first kick-start. :lol:

Mike
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

jharre wrote:
jmetal88 wrote:Bad news is that even with the external oscillator, the PCjr is still not receiving the occasional keystroke correctly.
Are these chips re-programmable? If so, it won't be a problem to implement code fixes. Even if you have to replace a $2-3 chip for an upgrade - not a big deal.
Not only are the chips re-programmable, but even if you have to replace one, you can get it for $1.10 plus shipping. I'm hoping actually mounting everything on a PCB and using shielded cable helps, though, because if it doesn't, it's a LARGE re-write that needs to be done to really lock down the timing. If it is a timing issue, I really think it's oscillator instability as opposed to anything in the code, though, and I'm not sure how to solve it if using an external crystal didn't help.
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

You know what? Honestly, I'm perfectly happy with this even if it does miss a scan code every three or four sentences. That's actually fewer missed keys than usually get caused by not having the wireless keyboard in the exact right position, and I don't even have the official keyboard cable to try to alleviate that.
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

So, just so everyone knows what kind of time table we're dealing with: All the parts will probably be here next week, but I'd expect the PCBs the week after. The place I order PCBs from is faster than many others in the same price range, but they still take about a week to produce and then at least 4 business days for DHL to get them over here from China.
Tempest
Posts: 342
Joined: Thu Jan 14, 2010 4:43 pm
Contact:

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

Post by Tempest »

Looking forward to this. My current PCjr keyboard has a broken tab on the connector so if I move it too far the cable pops out.
Omne ignotum pro magnifico

--- AtariProtos.com ---
The color of infinity inside an empty glass
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

I basically just tried my last ditch effort for fixing the timing in programming. The PCjr is still missing scan codes every once in a while, but I now 100% believe it's down to a hardware issue, either with the PIC circuit and its current layout or with the PCjr itself. What I did was I studied the assembly listing generated for my subroutine by XC8 to see how it was passing variables around and wrote my own assembler routine using cycle-exact timing to replace the part that actually outputs to the PCjr. It should be doing each transition after exactly 220 uS now, as long as the oscillator is operating properly. So this is the part where I really start hoping the move to a PCB and shielded cable will fix things. If not, I at least know I did my best, and I'm still pretty happy with the result.
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

So, I decided to experiment a little more systematically with the output timing on the converter tonight, and discovered something interesting. Apparently, the PCjr is MUCH more tolerant of transitions shorter than 220 uS than it is of those longer than 220 uS. With my timer preset set at a position that should have provided exactly 220 uS transitions, I was getting mostly hits, but a significant number of misses. So I tried setting it smaller, which would make the time between transitions longer. Suddenly, it wasn't working at all! So then I tried setting it higher by the same amount, making the transitions shorter than 220 uS. When set that way, it actually performed better than when set for 220 uS! I kinda wonder if I push it even farther if it will work better, or if maybe I've pushed it just slightly too far and need to come back the other way one or two steps. I'll do some more experimenting and see.
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

Alright, after a LOT of experimenting tonight, it seems the best I can get is anywhere from 212 uS to 216 uS. So I'll set the final code for 214 uS, which is a timer preset of 44. It's still not 100% perfect, but errors are very rare with this timing, and are about the same from 212 uS to 216 uS. 210 uS has significantly more errors, and there is a slight increase in the amount of errors at longer than 216 uS, with significantly more appearing at 222 uS.
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

It took me a while to figure out, but I got an SVN repository set up for the current code:

https://www.assembla.com/code/ps2pcjr-1 ... sion/nodes
jmetal88
Posts: 811
Joined: Sun Jul 25, 2010 10:22 am

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

Post by jmetal88 »

Hmm, yesterday and the day before it was really stable with the timer preset at 44, but today it's had a lot more missed scan codes. I don't really think there's a point in continuing to mess with it until the PCBs get here, though. It wasn't bad today, I just had to press backspace and fix a few more errors than I would have liked. It may be worth putting the board on the oscilloscope after I get the first one assembled to make sure the timing is the same as the timing I saw on the real PCjr keyboard.
Post Reply