
In computing, a keyboard controller is a device that interfaces a
keyboard to a
computer
A computer is a machine that can be Computer programming, programmed to automatically Execution (computing), carry out sequences of arithmetic or logical operations (''computation''). Modern digital electronic computers can perform generic set ...
. Its main function is to inform the computer when a
key is pressed or released. When data from the keyboard arrives, the controller raises an
interrupt
In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted ...
(a ''keyboard interrupt'') to allow the
CPU to handle the input.
If a keyboard is a separate
peripheral
A peripheral device, or simply peripheral, is an auxiliary hardware device that a computer uses to transfer information externally. A peripheral is a hardware component that is accessible to and controlled by a computer but is not a core compo ...
system unit
A system is a group of interacting or interrelated elements that act according to a set of rules to form a unified whole. A system, surrounded and influenced by its open system (systems theory), environment, is described by its boundaries, str ...
(such as in most modern
desktop computer
A desktop computer, often abbreviated as desktop, is a personal computer designed for regular use at a stationary location on or near a desk (as opposed to a portable computer) due to its size and power requirements. The most common configuratio ...
s), the keyboard controller is not directly attached to the keys, but receives
scancodes from a
microcontroller
A microcontroller (MC, uC, or μC) or microcontroller unit (MCU) is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs (processor cores) along with memory and programmable input/output peripherals. Pro ...
embedded in the keyboard via some kind of
serial interface. In this case, the controller usually also controls the keyboard's
LED
A light-emitting diode (LED) is a semiconductor device that emits light when current flows through it. Electrons in the semiconductor recombine with electron holes, releasing energy in the form of photons. The color of the light (corresp ...
s by sending data back to keyboard through the wire.
The
IBM PC AT
The IBM Personal Computer AT (model 5170, abbreviated as IBM AT or PC/AT) was released in 1984 as the fourth model in the IBM Personal Computer line, following the IBM PC/XT and its IBM Portable PC variant. It was designed around the Intel 802 ...
used an
Intel 8042 chip to interface to the keyboard. This chip had two additional functions: it controlled access to the
Intel 80286
The Intel 80286 (also marketed as the iAPX 286 and often called Intel 286) is a 16-bit microprocessor that was introduced on February 1, 1982. It was the first 8086-based CPU with separate, non- multiplexed address and data buses and also the f ...
CPU's
A20 line in order to implement a workaround for a chip bug, and it was used to initiate a software CPU reset in order to allow the CPU to transition from
protected mode
In computing, protected mode, also called protected virtual address mode, is an operational mode of x86-compatible central processing units (CPUs). It allows system software to use features such as Memory_segmentation, segmentation, virtual mem ...
to
real mode
Real mode, also called real address mode, is an operating mode of all x86-compatible CPUs. The mode gets its name from the fact that addresses in real mode always correspond to real locations in memory. Real mode is characterized by a 20- bit s ...
because the 286 did not allow the CPU to go from protected mode to real mode unless the CPU is reset.
The latter was a problem because the BIOS and services provided by real mode operating systems such as MS-DOS and similar operating systems could only be called by programs in real mode. These behaviors have been used by plenty of software that expects this behavior, and therefore keyboard controllers have continued controlling the A20 line and performing software CPU resets even when the need for a reset via the keyboard controller was obviated by the
Intel 80386
The Intel 386, originally released as the 80386 and later renamed i386, is the third-generation x86 architecture microprocessor from Intel. It was the first 32-bit computing, 32-bit processor in the line, making it a significant evolution in ...
's ability to switch to real mode from protected mode without a CPU reset. The keyboard controller also handles
PS/2 mouse
A mouse (: mice) is a small rodent. Characteristically, mice are known to have a pointed snout, small rounded ears, a body-length scaly tail, and a high breeding rate. The best known mouse species is the common house mouse (''Mus musculus'' ...
input if a PS/2 mouse port is present.
Modern interface
Today the keyboard controller is either a unit inside a
Super I/O device or is missing, having its keyboard and mouse functions handled by a USB controller and its role in controlling the A20 line becoming integrated into the chipset's
northbridge and then later into the CPU's built-in integrated memory controller.
See also
*
Keyboard buffer
*
AT keyboard
*
KVM extender
*
Embedded controller: The Intel 8042 and other keyboard controllers used in computers based on the IBM PC/AT design can be considered embedded controllers.
References
External links
KBD43W13 Keyboard and PS/2 Mouse Controller
Computer keyboards
Microcontrollers
Motherboard
{{compu-hardware-stub