Jump to page content

MOS/LSI single-chip keyboard encoders

Contents

Overview

The falling price of integrated circuits allowed for the entire keyboard encoding process to be implemented in logic at the end of the 1960s. Micro Switch was an early adopter with solid-state encoding, using a group of binary encoders to convert two-of-N codes to output codes, introduced around 1967. By 1970 another encoding technique had been invented: matrix scanning. A matrix scan keyboard examines each switch in turn, rather than having them all connected simultaneously as with previous designs, and this technique is exclusively built on digital logic.

By 1969 it was deemed viable to implement the entire encoder on a single chip, using large-scale integration (LSI), also commonly known as “MOS” after the MOSFET transistors in LSI chips. For two-of-N static encoding, this allowed the electrical monitor detector (EMD) circuit—which provides N-key lockout using electrical current monitoring—to be re-implemented in logic on the same chip as the binary encoder circuitry. For matrix scan keyboards, a single LSI encoder chip replaced anywhere from 12–16 separate DTL or TTL chips. Matrix scan keyboards—in both TTL and MOS/LSI forms—appeared on the market starting from 1970.

TTL-based matrix scan had a considerable limitation that the output codes for each key were defined by the matrix co-ordinates. Additionally, the processing for the shift and control keys had to perform bit manipulation to derive the modified output codes, and were thus limited to bit-paired layouts unless more complicated circuitry was employed. One workaround was to use the scanning circuit to address a ROM containing the look-up codes, with the matrix positions simply being the offsets into the ROM data, although this is rarely encountered in TTL-encoded keyboards. By comparison, an LSI chip could also include a look-up table in ROM for translating matrix positions to output codes, an approach that was widely adopted. Many encoder models however output only binary codes, either for addressing an external EPROM (for prototyping and low-volume orders) or to allow the host equipment to handle the code conversion instead. Typically the ROM would contain a separate code for each mode of each key, but National Semiconductor’s MM5740 saved on ROM capacity by only encoding the highest bits of each output code separately for each mode. The use of a ROM look-up table meant that the different modes could output completely unrelated characters, which is not possible with a simple TTL encoder.

The progress of technology marched on: in 1977, Micro Switch and IMSAI both introduced their first “intelligent keyboard”, each built around a microcontroller with the entire scanning logic held in firmware. This final approach—MCU-based encoders—proved to be the optimum one and has remained the method of building standalone keyboards to this day.

Characteristics

Using a single-chip encoder introduced limitations in keyboard functionality, which could in some cases be worked around by implementing some functionality in external TTL.

Keyboard size

The use of internal ROM limits the size of keyboard that the encoder can handle. Keyboard sizes from 88–99 keys were typical. General Instrument’s AY-3-4592 could handle a generous 112 keys (enough for a modern full-size keyboard) and National Semiconductor’s later MM57499 could handle 144 keys using an external decoder, or 96 keys natively.

Operation

Keyboard encoders can be either static or matrix scan (dynamic). A “static” encoder is one that is completely idle when no keys are being pressed. Pressing a key causes the encoder to observe the input and generate an output, including debounce processing and output code look-up. Matrix scan encoders, which are the more common type, continually check each matrix position to see whether that key is active. Static encoders are highly suited to Hall effect switches because of their ability to inherently provide dual isolated outputs (when the switch is inactive, current cannot pass between the output terminals), but double-pole switches or dual diode-protected outputs will also suffice.

Output

Single-chip encoders can be broadly divided into those with look-up ROM and those without. ROM-based encoders were mask programmed with a table of character codes to assign to the keys. Factory options included ASCII and EBCDIC; the customer could provide their own set of character assignments on punch cards. When a key is struck, the encoder reports the character code of the key pressed. In most cases, the state of the control or shift key is not revealed; for example, on an ASCII encoder, pressing shift+1 would emit 0x21 (the ASCII code for “!”) and pressing control+1 would emit 0x01. The host would see the output code and not know what combination of keys was pressed to generate it. This is in contrast to later practice where key press and key release were signalled separately.

ROM-less encoders generated binary sequential output: instead of a character code, each key emits the index into an external ROM where the character codes are stored. This allows the customer to define the output mapping independently of the encoder. The advantages of having the ROM external are for prototyping (prior to full scale production, including during the long lead time for custom mask creation) and for small production runs where it is more cost effective to place the output mapping onto a PROM or EPROM than have a custom mask made. At least one encoder model could be used with either external ROM or internal ROM, such that when moving from prototype to production, the customer need only remove the external ROM from the PCB.

Modes

Because keyboards of this era reported character codes instead of scancodes, it was entirely the keyboard’s responsibility for dealing with modifier keys. Single-chip encoders typically provided three or four modes. The basic three modes typically correspond to whether or not control or shift is pressed, with shift and control providing the second and third modes. The more common quad-mode encoders also cater for control and shift being pressed simultaneously. Thus, the look-up ROM holds three or four separate values for each key, for the three or four combinations of modifier key use. In most cases, these values are fully independent, but National Semiconductor’s earlier MM5740 model has bits 0–4 and 8 common to all modes to reduce the size of the ROM.

Signalling

Most keyboard encoders generate parallel output: a set of typically 8–10 data lines bear the output code. In order for the host to know when valid data is present, a strobe line is activated after a key is struck.

Serial output was provided by some encoder models instead.

Debouncing

Most encoders handle debouncing. This is typically performed by waiting momentarily before signalling that a key is pressed. In order to accommodate for the different bounce times between switch types, an external resistor and capacitor were frequently used to define how long of a delay to provide for debouncing.

Rollover and lock-out

Single-chip encoders frequently provided N-key rollover. With N-key rollover, notification of an active key is brief: the host is expected to be checking for new keystrokes continuously. After allowing enough time for the host to have observed the keypress, the encoder resumes scanning the matrix, without waiting for the previous key to be released.

The alternative option is typically N-key lockout. In lockout mode, matrix scanning is suspended until the key is released. After allowing time for the contacts to open fully (as some switches can suffer bounce on contact opening) the encoder resumes scanning the matrix.

Known models

The following table lists known keyboard encoder integrated circuits. These are LSI implementations that do not involve the use of a microprocessor. The datasheets are often not clear on the distinctions between the different models, and only brief details are given here at the moment.

Details of when such chips were first introduced is not clear; the oldest commercially-available scanning encoder discovered so far is General Instrument’s AY-5-2376, from a 1971 advertisement. The “earliest year” column reports the earliest year found on a discovered chip, advertisement or datasheet and does not necessarily reflect the year of introduction.

Model Manufacturer Keys Modes Bits/key Output Coding Earliest year Notes
S9021 American Micro-Systems 90 4 10 Parallel Mask programmable 1973
EA2000 Electronic Arrays 99 4 10 Mask programmable 1975 This model is advertised as being 99-key, although IC Master 1977 claims a 9×9 key matrix (which would be 81 keys)
EA2007 99 4 10 Pre-programmed 1975 EA2007 is advertised as a pre-programmed EA2000 which “provides encoding for standard ASCII and EBCDIC keyboards”
EA2030 99 4 10 Binary sequential 1975
AY-5-2376 General Instrument 88 3 9 Parallel ASCII, custom 1971 11×8 matrix; 88 keys × 3 modes/key × 9 bits/mode/key = 2376 bits of ROM; by default, the 9th bit is used for parity
AY-3-4592 112 4 10 Parallel 1982 16×8 matrix using an external multiplexer; supports “capacitive, magnetic, inductive, Hall effect [and] mechanical” switches using pulse detection
AY-5-3600 90 4 9 Parallel Mask programmable and binary sequential 1974
HD-0165 Harris Semiconductor 16 1 4 Parallel None 1971 16-key keypad 1-of-16 encoder; designed to be used with a second HD-0165 as 2-of-32 encoding of up to 256 keys; output codes defined solely by input connections
MCS 1007 MOS Technology 64 3 8? Parallel Binary sequential? 1972 Specifications are unclear, due to poor quality advertisement scan and no known datasheet; also known as MTS 1007
MCS 1008 28 2 8 Serial Output data is not specified in the advertisement; also known as MTS 1008
MCS 1009 90 4 10 Parallel Binary sequential? Specifications are unclear, due to poor quality advertisement scan and no known datasheet
MM5740 National Semiconductor 90 4 9 Parallel Mask-programmed 1974 9×10 matrix; bits 0–4 and 8 are common to all modes
MM5745 78 4 10 Parallel Custom 1977 2-of-13 input (non-matrix); listed as 2KRO/NKRO but no explanation is given regarding how NKRO works without matrix scanning
MM5746 9
MM57499 96/144 3 8 Serial ASCII and special codes 1980 96 keys natively (12×8 matrix), and 144 keys with an external decoder (12×12 matrix); serial input permits output passthrough or eight bits of status display
CDP1871 RCA 85 4 8 Parallel ASCII 1979 Not customisable
SCN2671 Signetics 128 4 8 Parallel/serial ASCII or matrix co-ordinates 1982 Combined keyboard encoder and UART; conductive and capacitive switches
KR2376 SMC 88 3 9 Parallel ASCII, custom 1973 Possibly a substitute for AY-5-2376
KR3600 90 4 10 Parallel Mask programmable and binary sequential 1976 Pin-for-pin replacement for GI AY-5-3600
KR9600 90 4 10 Parallel Mask programmable and binary sequential 1985 Direct replacement for the KR3600
KR9601 ASCII
KR9602 Serial Mask programmable and binary sequential
TMS 5000 Texas Instruments 90 4 ASR-33 1971 The details are only known from a single advertisement
TMS 5001 90 4 10 Parallel ASCII typewriter and bit-paired
ASR-33
Baudot
1975 The four encoding options are likely to be separate parts
MH1KK1 TESLA 16 1 Binary encoder Two chips are required for a keyboard above 16 keys
MH 103 120 8 Binary sequential Details on these models are unclear
MH 113 120 8
UA3533 Unisem/Solitron Devices 128 4 9 1971 This is a static encoder

Substitution and recreation

Like any integrated circuit, keyboard encoders are subject to eventual failure. Because many of these models were mask-programmable, it is not uncommon for the failed encoder to be a model specific to a particular computer vendor. For example, Apple used at least two different custom SMC KR3600 ROM masks in the Apple II and III computers (SMC parts KR3600-070 and KR3600-075). In some cases, finding a replacement encoder with the correct programming is difficult, expensive or impossible.

Although it is possible in many cases to “read” the contents of the ROM in an encoder (by creating a special harness circuit that simulates pressing each key in each modifier combination and recording what keystroke is returned, assuming that all ROM bits are included in the output), these chips were mask-programmable not PROM. Thus, even armed with the complete ROM contents, there are no blank encoders waiting to be programmed.

Fortunately, for some models there is a solution. It was common practice to offer both ROM-coded and binary sequential models. The underlying encoder circuit was largely identical, but the latter type lacked the coding ROM storage. Instead, the encoder outputs the memory address of the ROM entry, that can be fed to an external ROM. This approach provided a cost-effective means of prototyping keyboards before committing to mask production (or while waiting for the mask production), and equally a cost-effective way to produce small batches.

These ROM-less binary sequential models can thus be used in any keyboard in place of the original encoder. They must be paired with an external ROM, and thus a small daughterboard is required to hold both chips, that in turn fits into the position of the original encoder. The external ROM data can be produced by reading a working encoder by keystroke simulation, or by tracing the keyboard matrix to determine the co-ordinates in the matrix of each key. Where data such as parity is included in the ROM output, this must be taken into account.

An example of a daughterboard-based recreation of an encoder can be found on the Stardot forum in the topic Fixing a Superbrain up from page 4 onwards, which details the process of combining a ROM-less SMC KR3600-PRO with a spare EPROM as a substitute for a failed SMC KR3600-056.

In some cases, there is an equivalent part from another manufacturer, as was the case with certain SMC and General Instrument models.

Joe’s Computer Museum offers for sale the JCM Universal Keyboard Encoder, a recreation of the General Instrument AY-5-3600-PRO/SMC KR-9600-PRO, based on a Microchip PIC 16F18875 fitted to a daughterboard designed to fit in the original DIP-40 socket. Jumpering on the daughterboard allows the encoder to generate correct output for the Apple III and III+ computers. Custom programming is also offered as a service.