Structure of the keyboard: A keyboard is made using a microcontroller, usually from the Intel 8048 or 8051 families. These microcontrollers execute their own programs that are recorded in their respective internal ROMs. These programs perform a matrix scan of the keys to determine which ones are pressed.
Interesting: What is AZERTY keyboard
To achieve a flexible system, the microcontrollers do not identify each key with its screen-printed character, but instead assign a numerical value to each of them that only has to do with their physical position. If this were not done, this system would be very dependent on each language, it must also be taken into account that languages such as French have AZERTY keyboards instead of the QWERTY one in the United States. The keyboards used in Latin America and Spain extend the basic configuration of the QWERTY keyboard in order to include the letter eñe and facilities for accented letters. As the Spanish keyboard must be used for the various languages of the Iberian Peninsula, it facilitates above all the writing of various accents, even those not used in Castilian Spanish. The Latin American keyboard only supports specific Spanish characters with direct keys, which include two types of accent, the letter eñe and the beginning of exclamation and interrogation. All other accent combinations are obtained using a graph extension key (). For the rest, the Latin American keyboard is oriented towards programming, with easy access to the set of symbols of the ASCII standard.
Structure of the keyboard: For each press or release of a key, the microcontroller sends an identification code called Scan Code. To allow multiple keys to be pressed simultaneously, the keyboard generates a different code when a key is pressed and when that key is released. If the microcontroller notices that the keystroke has ceased, the new generated code (Break Code) will have a keystroke value increased by 128. These codes are sent to the microcontroller circuit where they will be processed thanks to the keyboard manager, which is nothing more than than a BIOS program and that determines which character corresponds to the pressed key by comparing it to a character table in the kernel, generating a hardware interrupt and sending the data to the processor. The microcontroller also has some ROM memory space that makes it capable of storing the last keystrokes in case they cannot be read due to the user’s typing speed. It must be taken into account that when we press, rebounds can occur (Bouncing) that duplicate the signal. In order to eliminate them, the keyboard also has a circuit that cleans the signal.
Structure of the keyboard: In AT keyboards the generated codes are different, so for compatibility reasons it is necessary to translate them. The keyboard controller is responsible for this function, which is another microcontroller (normally the 8042), this one already located in the PC. This controller receives the Keyboard Scan Code (Kscan Code) and generates the Scan Code itself. In any case, be it a PS/2 or AT keyboard, the Scan Code is delivered to the PC BIOS to identify the key pressed.
Keyboard communication is via serial. The communication protocol is bidirectional, so the host can send commands to the keyboard to configure it, reset it, diagnostics, etc.