A keypad consists of a set of buttons that may be pressed to provide input to an embedded system. Again keypads are common in the embedded system, since such system may lock the keyboard that comes standard with desktop systems.
The figure shows a simple keypad having buttons arranged in an N-column by M-row grid.
The device has N outputs each output is corresponding to a column and another M outputs, each output corresponds to the row.
When we press a button one column output and one-row output go high uniquely identifying the pressed button. To read such a keypad from software, we must scan the column and
row outputs. The scanning may be performed by a keypad controller. Such a device decodes rather than controls, but we will call it a controller.
The figure shows the controller which scans the column and row outputs of the keypads. When the controller detects a button press, it stores a code corresponding to that button into a register key-code. and sets an output high, k-pressed, indicating that a button has been pressed.
The software may poll this every output every 100 milliseconds or so and read the register when the output is high. Alternative by this output can generate an interrupt in our general purpose processor, eliminating the need for polling.