Single-chip keyboard encoders
- Known models
- Substitution and recreation
The falling price of transistor–transistor logic (TTL) chips meant that matrix scanning and output encoding in pure TTL became cost-effective. Matrix scanning offered a way to overcome the N-key lockout limitation of encoding switches, and a keyboard circuit with a small number of components. A complete keyboard scanning and encoding circuit could be built with as few as fourteen TTL parts, a design which Cherry championed at the start of the 1970s. Such circuits had the 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 would be 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 whether this arrangement was ever used with a pure TTL scanning circuit is currently not known.
However, it would not be long before it was found to be preferable to move the entire scanning circuit into a single chip. Single-chip large-scale integration (LSI) encoders are known from as early as 1969 (used in Micro Switch keyboards), and general-purpose models were on the market by 1971 (General Instrument’s AY-5-2376). These chips not only took care of the matrix scanning process (including debouncing) but also included a look-up table in ROM for translating matrix positions to output codes. These look-up tables had a separate (or with National Semiconductor’s MM5740, a partially separate) output code for each mode of each key, meaning that there need be no relationship between the shifted and unshifted character values emitted. For flexibility with prototypes and small production runs, some models did produce output for indexing an external ROM. These are only the earliest-discovered years; it is possible that each product type was available earlier than indicated.
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 proved to be the optimum one and has remained the method of building standalone keyboards to this day.
Several encoders, including those of TESLA and National Semiconductor’s MM5745, were designed not for matrix scanning but for static decoding two-of-N.
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.
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.
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.
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.
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.
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.
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.
|S9021||American Micro-Systems||90||4||10||Parallel||Mask programmable|
|EA2000||Electronic Arrays||99||4||10||Mask programmable||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||EA2007 is advertised as a pre-programmed EA2000 which “provides encoding for standard ASCII and EBCDIC keyboards”|
|AY-5-2376||General Instrument||88||3||9||Parallel||ASCII, custom||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||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|
|HD-0165||Harris Semiconductor||16||1||4||Parallel||None||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?||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||9×10 matrix; bits 0–4 and 8 are common to all modes|
|MM5745||78||4||10||Parallel||Custom||2-of-13 input (non-matrix); listed as 2KRO/NKRO but no explanation is given regarding how NKRO works without matrix scanning|
|MM57499||96/144||3||8||Serial||ASCII and special codes||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|
|KR2376||SMC||88||3||9||Parallel||ASCII, custom||Possibly a substitute for AY-5-2376|
|KR3600||90||4||10||Parallel||Mask programmable and binary sequential||Pin-for-pin replacement for GI AY-5-3600|
|KR9600||90||4||10||Parallel||Mask programmable and binary sequential||Direct replacement for the KR3600|
|KR9602||Serial||Mask programmable and binary sequential|
|TMS 5000||Texas Instruments||90||4||ASR-33||The details are only known from a single advertisement|
|TMS 5001||90||4||10||Parallel||ASCII typewriter and bit-paired
|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|
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.