Vintage PC pages
Home -> Vintage PCs -> Wang PC Keyboard

Wang PC Keyboard

Note: You need a browser capable of displaying SVG images to see the keyboard layouts.

The Wang PC was a non-IBM compatible MSDOS PC (my specimen dates from 1985 or so). Its incompatibility extends to the keyboard, which differs in layout, pinout and communication protocol.

Here is the pinout of the keyboard socket (viewed from outside the case):

Note that unlike the IBM PC keyboard, which has a bidirectional data line and a separate clock line, this keyboard has two unidirectional data lines. The one I have designated 'Receive' (coloured yellow) is for transmission from the keyboard to the host PC; the 'Send' line (coloured white) is for transmission from the host to the keyboard.


The keyboard circuit board is branded 'Keytronic'.

The microcontroller used is an 8051.

The keyswitches are foam-and-foil switches. Considering how old these keyboards are by now, it's quite likely that the foam has disintegrated, meaning that the keys no longer register. If so, it can be replaced with double-sided sticky pads.

Wire Protocol

The transmission protocol used is (as far as I can see) something like RS-232 (but using TTL voltages, which I think makes it RS423). At the keyboard end, communication is handled by the 8051's built-in UART.

A bit is roughly 16μs long. The 8051 is placed in 9-bit mode, with the ninth bit always 1 on both transmit and receive.

If a key is not configured to send key-up scancodes, then after it is pressed the transmit line will be held low (as shown) until it is released. If it is configured to send key-up codes, the transmit line is left high after the stop bits are sent.


The keyboard returns the following scancodes:

When the keyboard powers-up, only the two Shift keys (shaded grey) send key-up scancodes (as on an XT, this is indicated by having bit 7 set). All the others send key-down scancodes and then pull the 'Receive' wire low until the key is released.

The four pads shown with dotted outlines do not have keys above them, but return scancodes if pressed on the circuit board. One of them (shaded orange) transmits the same scancode as the right-hand Shift.

The scancodes shown in blue belong to unused pads under double-sized keys.

The technical reference manual also describes a variant with five extra keys:

Between left Shift and Z
Where 1F is on the standard keyboard; 1F moves to between = and Backspace.
Between [ ] and GL
Between ' " and Return
Between . > and / ?

Keyboard Commands

Bytes can be transmitted to the keyboard using the same protocol and timings, but on the 'Send' wire rather than the 'Receive'. Commands are:

01 nn These commands set a list of keys that return key-up scancodes, replacing any previous such list. The two Shift keys need not be included in the list as they will always return key-up scancodes.
02 nn nn
03 nn nn nn
04 nn nn nn nn
05 nn nn nn nn nn
06Set all keys to return key-up scancodes.
07Set only the two Shift keys to return key-up scancodes (as at power-on).
08Reset the keyboard.
09Keyboard ID. Two scancodes will be sent to the host: 01h (Acknowledge) followed by 34h (identity).
0AKey click.
0CRepeat last scancode sent.
0EReturn status of DIP switches. Three scancodes will be sent to the host: 01h (Acknowledge), then the state of the left-hand switch bank, then the state of the right-hand bank. Bit 7 in a byte corresponds to the left-hand switch.
0FReturn beeper / keyclick volume as set by command 20h. Two scancodes will be sent to the host: 01h (Acknowledge), followed by the volume.
10Turn on LED 1 (Lock key)
11Turn off LED 1
12Turn on LED 2
13Turn off LED 2
14Turn on LED 3
15Turn off LED 3
16Turn on LED 4
17Turn off LED 4
18Turn on LED 5
19Turn off LED 5
1ATurn on LED 6
1BTurn off LED 6
1CTurn on all LEDs
1DTurn off all LEDs
1EGet LED status. Two scancodes will be sent to the host: 01h (Acknowledge), followed by a byte giving the state of the LEDs. Bit 0 = LED 1, Bit 1 = LED 2 and so on.
20 xxSet beeper / keyclick volume. Bits 0-2 give beeper volume, 0=mute Bits 3-5 give keyclick volume, 0=mute
31 xx Program the keyboard's SN76489AN sound generator. These are used in the self-test to make the keyboard speaker emit different tones. The parameters control the pitch.
32 xx xx

John Elliott 27 June 2011.