• Please review our updated Terms and Rules here

AT to XT Keyboard Converter

50 uS high, 50 uS low - 100 uS total.

Probably doesn't matter all that much, since the PC just uses a 9 bit shift register to receive data--and the holdoff is automatic when the 9th bit is shifted in. I'd be surprised if you couldn't drive an XT with a 1MHz bitrate, assuming that you controlled ringing on the cable.
Understood, just thought I would set it to something sensible
It's been so long since I constructed the table, that I don't have any of my work from building it. I may have constructed it from an online source or the 5170 Techref. At any rate, take a look at the XTTRANS.INC file in the source code (much earlier in this thread). That's organized as AT-to-XT translation. XT-to-AT to me is a mess because of fewer keys on the XT than the AT, meaning that some multi-key strokes will be needed for stuff such as F11 and F12, right-Alt and right-Ctrl, etc.

I looked at it, but it's hard to check my list against. I thought I'd at least ask about alternatives. I'll see if I can awk/sed it into submission by replacing the numbers with names.

I considered the table approach, but ended up creating a large switch statement to allow folks to modify the mappings more easily. Obviously, a table is more compact. Still, it makes it easier to handle double/triple key code items.

Jim
 
Oh, I totally understand. And, I threatened to do it a few times in this code, but it has not happened yet.

OK, I did some VI/EXCEL massaging, and got a good mapping document. I found a few holes in my mapping, so I fixed those. But, I ran across two mappings I did not understand:

You have PS2 backslash mapped to XT code 42, but http://ilkerf.tripod.com/c64tower/F_Keyboard_FAQ.html#KEYBOARDFAQ_037 shows it as 29.
Also, PS/2 code 0x61 is mapped to XT code 45, but I don't know what that is in either KB mapping.

Mapping document is here: View attachment mapping.zip
 
There was a lot of cut and try--the amount of bad information out there is staggering. Ultimately, I used the 5170 techref KB section as a reference, along with the 5150 tecref. IBM tends to get their documentation right.

You'd better believe that I got the backslash mapping right for a machine that pretty much runs DOS only!
 
Looking at the 5150 reference, it shows the INT2 key on position 43, not 42, but the MS refernence shows it as position 42.

The MS ref shows |\ on both 29 and 42, depending on the KB type. (US versus international). I wonder if you send the INtl |\ if all the apps map it to the same place, or if I need to offer a config option to switch the mapping.

Thanks for the links.
JIm
 
looks like you are going to buy the very last kit available. sorry future visitors, we're all out.

Well that's nice... looks like I'm building my own converter then. I cannot justify paying $70.00 for an XT keyboard.
 
William, I may have an XT keyboard for you. Lemme know.

I appreciate the offer, and at some point I'll most likely take you up on it. But I've also been thinking about doing this project for a while, and I have a small microcontroller (and associated programmer) that's seeking 'employment in a good job'.

EDIT: In my zeal to do this, I forgot an important fact: Said microcontroller is not 5v tolerant. Yes, I could use a resistors for inputs, and a regulator for power... but would the computer accept 3 volt output from the microcontroller as a TTL input (Is the interface TTL anyway)? It is possible to generate 5 volts using a Dickson charge pump, but that may be overkill for this!
 
Last edited:
OK. I've got an IBM 83 key that needs a little work on the left ALT key (but it works fine) and a boxed Key Tronic AT/XT switchable.
 
The XT keyboard interface is open-collector, with 4K7 pullups to +5. So, in the case of host-side pullups, you'll want to clamp the lines using a 3.3V zener or some other scheme. But 3.3V is more than sufficient for a logic high on the interface lines. LDO regulators are cheap and plentiful.
 
Trying to make my own working circuit was among one of the stupidest ideas I've had to spend my free time in a long time... 4 hours only to yield 2 broken microcontrollers and a circuit that cannot even be programmed properly due to God knows what went wrong. This ordeal left a bitter taste in my mouth... I think it's time for a break from microcontrollers for a bit. With that said, anyone got a spare they're willing to sell (Stone: It's not convenient for me to come pick up anything anytime soon)?

EDIT: Okay, maybe that was a knee-jerk reaction. I'll try again tomorrow. But I can't say I'm thrilled about how poorly just making the circuit went.
 
Last edited:
The XT keyboard interface is open-collector, with 4K7 pullups to +5. So, in the case of host-side pullups, you'll want to clamp the lines using a 3.3V zener or some other scheme. But 3.3V is more than sufficient for a logic high on the interface lines. LDO regulators are cheap and plentiful.

I'm sorry, I cannot get this right for the life of me. Are the pull-up resistors on BOTH the host (computer) side and device/master (keyboard) side? Most references I've seen so far appear to say only the keyboard side has pull-up resistors... at least for the AT-interface.

The ultimate goal for me is to create a circuit that can accept any combination of XT/AT keyboard and host (i.e. XT keyboard/XT host, XTK/ATH, ATK/XTH being the big one of course, ATK/ATH)... and depending on which sides have pull-up resistors makes it either easy or difficult to create such a circuit. For those who might be asking why would I want to do that? To have this circuit sit at the output of a KVM switch!

http://www.ti.com/lit/an/slaa148/slaa148.pdf
Section 5.1 shows an Op-Amp bidirectional interface for converting between 3.3V to 5V... simply check for a response on the host end/keyboard end, and switch between AT/XT device/host as need (if it detects that both sides match, the MSP430 drops out of the circuit, or is a direct passthrough in some manner).

My two issues I can envision running into are:

1. I have 374s on hand, and let's be honest; LM374 isn't a wonderful Op-Amp, and it might consume too much current.
2. Where do I place the pull-up resistors on the microcontroller side, since it sits between the keyboard and host? From the point of view of the keyboard, the MSP430 is a host, and from the point of view of the host, the MSP430 is a keyboard.

And yes, I finally got my MSP430 programmer to behave with my soldered circuit XD.
 
Last edited:
I'm sorry, I cannot get this right for the life of me. Are the pull-up resistors on BOTH the host (computer) side and device/master (keyboard) side? Most references I've seen so far appear to say only the keyboard side has pull-up resistors... at least for the AT-interface.

I've seen pullups in both places. Moral: Don't count on things one way or the other. You really want 5V tolerant inputs and outputs.

1. I have 374s on hand, and let's be honest; LM374 isn't a wonderful Op-Amp, and it might consume too much current.
2. Where do I place the pull-up resistors on the microcontroller side, since it sits between the keyboard and host? From the point of view of the keyboard, the MSP430 is a host, and from the point of view of the host, the MSP430 is a keyboard.

You can also use discrete MOSFETs to do the dirty work, if you're on the cheap. I know that you probably like the MSP430--I do, for some super-low-power applications. But there are lots of cheap small MCUs with 5V tolerant I/O. Some members of the AT90USB family look attractive in that they have a PS/2 keyboard interface and a factory-programmed bootloader as well as 5V tolerant logic.
 
I've seen pullups in both places. Moral: Don't count on things one way or the other. You really want 5V tolerant inputs and outputs.

know that you probably like the MSP430--I do, for some super-low-power applications. But there are lots of cheap small MCUs with 5V tolerant I/O. Some members of the AT90USB family look attractive in that they have a PS/2 keyboard interface and a factory-programmed bootloader as well as 5V tolerant logic.

Well, I can also cheat using resistor dividers :p!

Although I like MSP430 a lot (it's easy to learn/use), part of the reason I'm using it is that I only have an MSP430 and PIC24/32 programmer... PIC24/32 is overkill for this... and buying a programmer for another uC family would honestly cost more than another Model F keyboard.
 
Those Atmel AT90USB MCUs come with their own USB bootloader. All you need is a cable. Kind of cool and cheaper than an FTDI chip to do USB->anything conversions.
 
Oh! I should've realized that's what you meant by bootloader. Well I will keep my options open. In the meantime, I have verified that 3.37 volts to my PC/AT is sufficient for the motherboard-side... although it's still valid TTL, I'm just so used to using 5V as high instead of 3.3.

Using Ohm's Law, I empirically calculated the pull-up resistors to be 9576.2 Ohms (probably actually 10 kOhms) on the PC/AT motherboard side.
 
Back
Top