How Computer Keyboards Work Written by Matthew Elton When you press a key on the keyboard, a piece of metal on the bottom of the key connects two pieces of metal on a circuit-board beneath the keys. This completes an electrical circuit, sending an electrical charge to a tiny processor located inside the keyboard. There is a different wire leading into the processor from each key, allowing the processor to tell which key ha been pressed by which wire the electricity is coming from. The processor contains a 16-byte buffer memory module, which has stored in it, the code for each to send to the Keyboard Controller when that key is pressed, and an image of the letter each key represents.
The cable that connects the keyboard to the computer allows the keyboards processor to send data to the computer. It also supplies the keyboard with the electricity it needs to run, usually five volts.
Located near the port (usually the PS/2 port or USB port) where the keyboard connects to the computer is the motherboards Keyboard Controller. The Keyboard Controller receives electrical code (consisting of positive and negative charges or pulses of electricity represented by 1s and 0s in binary code) when a key is pressed. The code is different for each key, so the Keyboard Controller can tell which keys have been pressed by the configuration of the code. Upon receiving the electrical message that a key has been pressed on the keyboard, the Keyboard Controller sends an electrical signal to the Operating System (such as Windows) which is located on the hard drive but actively running in the processor.
When the Operating System receives the signal that a key has been pressed, it checks to see if the keys that were pressed were a system level command such as Cntrl-Alt-Delete or anything having to do with the Cntrl and Alt keys. If is a system level command, the operating system performs the task that command represents. For instance, Cntrl-Alt-Delete opens the task manager, or Alt-F selects the File menu.
If the Operating System does not recognize the keys that were pressed as being a system-level command, then it sends the data (that was generated by the Keyboard and Keyboard Controller when the keys were pressed) to the application that is selected and running, located on the hard-drive and running in the processor. The application, such as Microsoft Word, recognizes the keys that were pressed and displays them on the monitor by sending a signal through the video card to the monitor (for instance, if you typed the Z key in Microsoft Word, Microsoft Word would recognize this as a key that can be used in Microsoft Word, and the letter Z will appear on the screen). If the program that is running does not recognized the keys that were pressed as being valid keys that can be used in the program, nothing will happen (for instance, if you pressed the Z key while running the calculator program, nothing would happen since the Z key cannot be used in the calculator, only number keys and math symbols can be used). If there are no applications running and the keys pressed are not system-level commands, than the operating system will ignore the keystrokes and nothing will happen (for instance,
if you had no programs running and you pressed the Z key, nothing would happen). Many people consider keyboards as being one of the simplest parts of the computer, however, when you think of everything the computer does to display a single letter on the screen, and how it does it all instantly, it is pretty amazing.