Keyboard is one of the most used input devices. Keyboard is a device with keys for alphanumeric characters along with various other keys to assist using the computer by sending instruction to the computer. The process of sending an instruction to the computer from keyboard when a key in the keyboard has been pressed is described below.
The process of accepting input from keyboard can be described as follows.
How computer accepts input from keyboard
When we press a key, a tiny chip in the keyboard called keyboard controller notes that a key has been pressed. Keyboard controller places a coed in the buffer of the keyboard to indicate which key was pressed. Keyboard buffer is a temporary memory of the keyboard controller. The keyboard controller sends a signal to the system software notifying that something happened at the keyboard.
When the system receives the signal it determines the appropriate response. When a keystroke has occurred, the system reads the memory location in the keyboard buffer that contains the code of the key which was pressed. The system software then passes that code to CPU.
Lets see the steps in how computer accepts input from keyboard
Key has been pressed
The first step is to press a key in the keyboard. Each key has key code associated with it. This is the event that starts the process
Store the key
A tiny chip called keyboard controller will take action as a key has been pressed and will store the key code to a memory called keyboard buffer. A buffer is a volatile memory that holds data until they can be processed.
Notify the system software
Next, the keyboard controller sends an interrupt request to the system software to read the key code from it’s buffer.
Read from buffer
The system software, when it’s convenient, reads the key code from the keyboard buffer.
Send to CPU
After the system software read the key code from the queue of the keyboard buffer, it sends the key code to CPU for further processing.
After the key code being read by the system software, it will be removed from the queue of the keyboard buffer.