A keyboard controller is a type of integrated circuit inside most computers that is designed to accept input from a keyboard and transmit it to the central processing unit (CPU), where it then can be passed to the operating system for interpretation. In general, when a keyboard controller receives a signal from a keyboard or similar input device, it generates a signal known as an interrupt that causes the CPU to briefly halt execution so it can handle the signal the keyboard controller is sending. Depending on different hardware specifics, a keyboard controller receives different sequences of bits from the keyboard and then passes this information through a lookup table, where the information is translated into bytes known as scan codes that can be more easily interpreted by the CPU. The controller also handles the interpretation of some physical aspects related to a keyboard, such as timing key presses when a key is held down for a long time, and activating or deactivating the light-emitting diodes (LEDs) that indicate number lock or capitals lock on the keyboard itself.
The location of the keyboard controller can vary, but the integrated circuit traditionally is on the motherboard of the computer. In instances in which the keyboard is not an integral part of the computer, the controller is almost never inside the keyboard hardware. The opposite is true for keyboards that are part of the computer structure, such as in a laptop. There also are situations in which there is not a separate keyboard controller but the functionality is emulated through other parts of the processor.
The hardware that is inside a traditional computer keyboard sends information to the controller about which keys have been pressed, usually by measuring a change in the current under the individual keys. This signal is standardized by a circuit similar to the keyboard controller in the computer. This means that every keyboard has knowledge of its own topography and the location and arrangement of the keys, and can send the same signal when a user presses the return key, no matter where the key is on the keyboard or what physical design the keyboard has.
The controller inside the main computer takes this signal and converts it into a scan code, which is more easily interpreted by the CPU. Modifier keys, such as shift or control, are passed along with any other keys that are being pressed. At this point, the keyboard controller sends a signal to the CPU that causes it to stop its present action and retrieve the scan codes. The CPU then passes the scan codes to the system where, in many operating systems, a system event is generated and passed along to be processed by the active program.