Rollover and lockout
- Historical context
- Sensing limitations
- N-key rollover definitions
- See also
Rollover is the ability of a keyboard to report further keypresses before previous keys have been fully released. Lockout is a physical or electronic restriction that ensures that only one key can is reported or can be pressed at once. N-key rollover (NKRO) is normally defined as the ability to simultaneously detect an unlimited number of keys, but the definition depends on the context. N-key rollover is not a requirement for typing, but video games can require more than two keys to be held at the same time, and increased rollover capacity reduces the likelihood of the keyboard causing problems for game playing. This was especially true in the 90s before the rise of network gameplay, when two players would share the same keyboard, giving rise to abnormally high numbers of concurrently-pressed keys compared to the expectations from terminal, typewriter and computer manufacturers.
It is taken for granted now that keyboards permit multiple keys to be pressed in rapid succession or held simultaneously. However, many early keyboard types in the 1960s and very early 1970s made this impossible, either physically or electronically. Invac’s photoelectric keyboards for example used a mechanical interlock to physically prevent more than one key to be pressed at once, because the sensing mechanism could not understand simultaneous key depressions. Keyboards using electrical encoding switches, such as those from Mechanical Enterprises and Micro Switch, did not physically prevent simultaneous keystrokes, but as these keyboards too could not understand such actions, output from the keyboard was suppressed when two or more keys were operated at the same time.
In US patent 3698531 “Solid state switch” filed in October 1970, ITW noted:
Roll-over is the tendency of a particularly fast operator to depress a second key before a previously depressed key is released. A certain degree of roll-over is desirable because it permits increased typing speeds. However, if roll-over is excessive, it results in a double strike. That is, the keyboard will emit signals which are a combination of the signals which each of the two keys would emit if depressed individually.
In prior art keyboards of the type employing electrical contacts mechanically closed by depression of a key, the problem of roll-over was overcome by employing mechanical interlocks. These interlocks permitted one key to be partially depressed before another key was released, but would not permit two keys to be depressed far enough so that the contacts associated therewith were closed at the same time. In this type of keyboard, the problem of transfer timing was solved by providing an additional set of contacts. This set of contacts would not close until after the data-representing contacts were fully closed. The signal produced by the additional set of contacts was then used to strobe a set of gates which gated the data-representing signals from the keyboard into the processor.
N-key rollover is discussed in the Focus on Keyboards article in Electronic Design magazine in 1972 [ED1972-FOK]. Here, N-key rollover is said to be a term originating at Micro Switch, indicating that during fast typing, the keystrokes are transmitted in the correct order no matter how many keys are not yet released. N-key rollover (“NKRO”) is contrasted here with “2-key rollover” (“2KRO”), defined as being where “an electronic interlock prevents errors when two keys are simultaneously depressed”, a fundamental limitation of some keyboard types. This early definition of two-key rollover is very different to the modern definition, in which the keyboard guarantees that a minimum of any two keys can be pressed or held simultaneously. This definition of 2-key rollover is also referred to as “N-key lockout”.
The article goes on to say:
Key Tronic proposes still another approach—selective N-key rollover, a combination of 2KRO and NKRO. The keyboard becomes locked after a fixed number of keys have been depressed—and are held depressed. Key Tronic claims that this approach is less expensive than NKRO but just as advantageous.
It is not clear what switch type is being described here. Key Tronic are best known for their capacitive keyboards, but this article could have been referring to their reed keyboards. N-key rollover is also discussed in the 1976 Focus on Keyboards article in Electronic Design magazine [ED1976-FOK]. Here, the details are even less clear. N-key rollover was shown by studies to result in 30% fewer errors compared to two-key rollover, and the article indicates that the 10–15% higher cost for N-key rollover is justifiable for workloads involving extensive text input. However, modern keyboards clearly demonstrate that N-key rollover is not a real requirement: virtually all keyboards produced today are two-key rollover—with optimisations made to accommodate modifier keys—and typists do not see errors resulting from not having N-key rollover. The article mentions a number of ways in which two-key rollover can produce unexpected or erroneous output, but none of these limitations exist with modern two-key rollover keyboards. N-key rollover does maintain an advantage for gamers in that there is no risk of blocked keystrokes from any combination of keys, but it is no longer a requirement for fast, accurate and reliable typing.
The 1976 article does also note the following, however:
If you do choose a rollover option, be warned: Not all options work exactly alike, even if called by the same name. There are many versions of each type. Even a single company can offer several choices. Key Tronic offers a choice of three types of two-key and four N-key rollover. Although Key Tronic explains its versions, many companies don’t.
The modern definitions of N-key rollover and two-key rollover are far more precise and clear-cut than the way that these terms were treated historically, when keyboard technology was still in its infancy, and the complex electronics required for reliable input were considered too expensive in many cases.
N-key rollover requires the ability to detect every key independently: no matter how many keys are held, the next key to be pressed must be able to be directly detected. Historically this was only a consideration for fast typing, where finger rolls (a very rapid sequence of keystrokes) could result in several keys being active simultaneously. Some switch types can inherently detect keys in complete isolation, such as capacitive keyboards, inductive keyboards and certain Hall effect implementations. However, conductive keyboards wired in a matrix exhibit a problem known as “ghosting”, where wrong-direction current flow with specific key combinations causes the encoder to erroneously detect keys that were not pressed. These erroneously-detected keystrokes are described as “phantom” or “ghost” keystrokes. US patent 4106011 “Keyboard circuit” filed by Tektronix Inc. in 1975 uses both the terms “phantom key” and “ghosting effects” in relation to rollover, indicating that these terms date back decades.
Dave Dribin’s Keyboard Matrix Help page explains the ghosting phenomemon in detail. Keyboards with a PCB are able to resolve this quite simply (but at an additional cost) by using diodes to prevent wrong-direction flow through matrix pathways. There are at least two reported means of achieving N-key rollover on a membrane keyboard, but as the definition of “N-key rollover” has never been precisely used, and the full details from these manufacturers have yet to be found, it remains to be seen what arrangements these were.
Rollover management has been the subject of many patents, including those detailed below:
|NCR||US 3675239||Unlimited roll keyboard circuit||1970-09-14||1972-07-04|
|Illinois Tool Works||US 3698531||Solid state switch||1970-10-26||1972-10-17||Rollover support for ferrite core keyboards, using six magnets|
|MOS Technology||US 3792466||Keyboard entry system with n-key rollover and n-key lockout protection||1972-05-31||1974-02-12||This appears to be a patent for their 64-key single-chip encoder|
|Illinois Tool Works||US 3978474||Keyboard with n-key lockout and two-key rollover protection||1975-07-15||1976-08-31|
|Oak Industries||US 4420744||Keyboard crosspoint encoder having N-key rollover||1981-02-12||1983-12-13||Oak Full-Travel Membrane|
|Alps Electric||JP H051485||キーボードのキ一出力方式||1984-07-24||1986-02-14||2-key rollover; published in English as US 4922248|
|Alps Electric||US 4922248||Key output method for keyboards||1988-11-23||1990-05-01||US equivalent of JP H051485 (filed July 1984, above)|
N-key rollover definitions
The standard definition of requires that the keyboard be able to independently detect every key, regardless of how many other keys are held at the same time. With keyboard protocols that provide interrupt-driven sequential press and release reporting, there is no signalling limit, but the operating system cannot necessarily memorise an unlimited number of held keys. Acorn MOS, designed around a 2-key rollover keyboard in the BBC Micro, reserves exactly two memory locations—two bytes—to remember up to two keys pressed during the last interrupt–scan event. (Here, only the existence of one more pressed keys is notified by interrupt, after which the OS scans the matrix to identify which two keys were held.)
USB is more awkward, because as a polled instead of interrupting protocol, it reports the list of keys currently held, not the individual press and release events, which in its most basic form is up to six keys plus eight modifiers (four left and four right).
Most keyboard designs require each switch to be wired in series with a diode to allow for independent key scanning. Without this, the number of simultaneously-detected keys can be reduced to as few as two, due to ambiguous readings from the circuitry when specific patterns of keys are held (“ghosting”, where extraneous keys are detected when electric current diverts the wrong way through one of the switches).
Micro Switch effectively defined N-key rollover as the ability to press an unlimited number of keys in sequence (not concurrently) without the previously-pressed keys interfering with the detection of later keys. This was accomplished by having the switches only conduct current for a tiny fraction of a second: by the time the next key is pressed, the previous key no longer registers. This approach comes at the cost of being able to detect key release, which for typing purposes is irrelevant unless typematic repeat is desired. This method was not necessarily a disadvantage in context, because ASCII keyboards were prevalent, and they had no concept of press and release: the ASCII character was automatically transmitted to the host on keypress. Typematic repeat under these conditions was achieved by having a Repeat key, that was used in conjuction with another key to indicate that it should be repeated. A standard switch was placed under the Repeat key to allow separate press and release to be detected.
Each of 1PB800, SW and SN Series and SD Series provided press-only detection to this aim; KB series switches mechanically release the contacts, while SW and SD series solid state switches electronically shut off the output transistors to stop current flowing through them. SW and SN Series define the period that the switch conducts electricity to be 10–100 µs.
This definition is found in the 1973 Solid State Keyboards brochure.
US patent 4420744A filed in February 1981 covers achieving N-key rollover with a membrane keyboard, in particular their FTM keyboards. Their idea of N-key rollover is misleading, however. They do not offer true N-key rollover; rather, they describe a means to allow any number of simultaneous keypresses excluding phantom conditions: the controller will output every key pressed except for any set of keys that are involved in a ghost (or “phantom”) situation. The scan rate should be sufficient for all keys to be registered so long as they are pressed and released in sequence (as with fast typing) where the previously-blocked keys will get detected as the ghost situation clears. However, this is not the same as proper N-key rollover where any rollover sequence is valid including those that would trigger phantom keys on a lesser keyboard.
Commonly offered by single-chip encoders in the 1970s, N-key lockout is a software implementation of the hardware constraints of certain encoding types such as photoelectric, where only a single key is read at once. Matrix scanning stops as soon as an active key is detected, and resumes once the key is released. If a second key is pressed before the first key has fully released, it will be reported in turn if it remains detected once the first key has become inactive.
N-key rollover means that the keyboard will continue scanning the matrix once a key has been detected. The literature for encoder ICs indicates that, upon key detection, the detected key undergoes a debounce cycle, and matrix scanning is suspended until the debounce cycle completes. Once debounce completes, the encoder will flag that key as active in RAM, report its output code, and resume scanning the matrix for any other keys pressed. On subsequent passes, any active keys already flagged in RAM as active will be skipped.
IBM Personal Computer and PS/2 keyboards, which were microcontroller based, work similarly: as a key is detected, it is reported immediately. However, unlike earlier systems, key press and key release are reported separately. This allows the operating system and application software to see which keys are held, which is important for games and other applications. As such, the onus in on the operating system to remember all the active keys. This may be where the notion has arisen that N-key rollover means that the host be able to detect which keys are pressed at any given time.
With USB, the host is required to poll the keyboard for active keys, and the keyboard responds with a list of keys currently active. However, USB also permits a key-pressed bitmap spanning the entire keyboard, allowing the state of every key to be returned on each polling cycle.
2-key rollover is a subset of N-key rollover where only a small number of simultaneous keypresses can be reported. In Acorn MOS (introduced in 1982), the keypress limit is literally two keys, as two bytes in the 6502’s zero page are set aside to record up to two detected keys. In modern keyboards, 2-key rollover guarantees that at least two simultaneous keypresses can be detected; the actual number may depend on the controller’s knowledge of the matrix, with scanning for additional keys being halted once a ghost condition is met.
Conductive-sensed matrix keyboards without diode protection typically employ some method of ensuring that phantom keypresses do not appear when too many keys are pressed simultaneously, but this is not always the case. Pages 64–65 of the Amiga System Programmer’s Guide from Abacus in 1987 describes how the Amiga 1000 keyboard has no such protection, and invites the reader to hold A, Q and Tab at the same time and watch the Caps Lock key light up unexpectedly. The author goes on to say that “This effect can be seen in many inexpensive matrix keyboards; it isn’t limited to just the Amiga.” (While this claim may be true, it is hardly a flattering comparison to make of the Amiga 1000 keyboard, as it was not an inexpensive machine!)
Two-key rollover requires the matrix to be carefully laid out in order for keyboard shortcuts involving three or more keys to work correctly. Older keyboards may not support more modern keyboard shortcut practice correctly, as ghosting conditions are triggered, resulting in phantom keys or the shortcut being completely blocked. For example, the Monterey K102 was found to have the following restrictions on certain shortcuts:
|Shortcut||Possible combinations||Rejected combinations|
|Control + Alt + F11||Right Alt + Left Control + F11||Left Alt + Right Control + F11|
|Control + Alt + F12||Left Alt + Right Control + F12||
Left Alt + Left Control + F12
Right Alt + Left Control + F12
|Control + Shift + Home||Left Control + Left Shift + Home||
Right Control + Right Shift + Home
Left Control + Right Shift + Home
Right Control + Left Shift + Home
Implementing N-key rollover would have prevented these limitations, making the K102 (and presumably also the K101) more usable on modern computers. Instead, older keyboards can end up unsuitable for some tasks where modern keyboards with more carefully-planned matrix layouts do not block keyboard shortcuts.
6-key rollover is a limitation of the USB boot protocol, designed to ease the burden on BIOS developers for handling keyboards. As 2-key rollover is perfectly adequate for most purposes, few keyboards have any need to surpass this limitation, but video games requiring extensive keyboard manipulation may find this limit to be a problem. In practical terms, increasing the level of rollover brings diminishing returns considering that few users have more than ten fingers and thumbs, and being able to hold any six arbitrary keys is already surplus to requirement for most if not all serious applications.
Conductive sensing using a key matrix requires a diode at each key position to prevent incorrect key detection. IMSAI’s IKB-1 for example specifies diode type 1N4148, with 1N914 as a permissible alternative.
A major limitation of membrane keyboards is that diodes cannot be soldered to the membranes to provide current flow. Nonetheless, at least two membrane keyboard manufacturers have claimed to achieve N-key rollover on a matrix keyboard:
Various Mitsumi membrane types of the 90s, including Mitsumi KUJ, KUK and KUL types featured “chip diode on membrane” to accomplish N-key rollover on a membrane keyboard. No further details are known, and no such keyboards have ever been examined to determine what they meant specifically. No other manufacturer is known to have ever used such a technique, despite the obvious advantages of such a feature on low-end gaming keyboards.
Fujitsu’s FKB74xx and FKB76xx datasheets also indicate that N-key rollover is possible on their membrane keyboards, using their “resistance matrix method”:
- Ghosting and N-key rollover explanation — Dave Dribin