quote


Keypad Inteface with Microcontroller



EmmbededKeyboards are the most widely used input devices of the 8051, and a basic understanding of them is essential. At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and column through ports; therefore, with two 8-bit ports, an 8*8 matrix of keys can be connected to a microprocessor. When a key pressed, a row and column make a connect; otherwise, there is no connection between row and column.




Emmbeded

4 x 3 Hex Keypad

When a key is pressed, the row for that key will be physically connected to the column for that key. Therefore, the port input for the column will be at the same logic level as the port output for the row.

Since the columns (inputs) are normally at the HIGH logic level due to pull-up resistors, the only way to make a column LOW will be to press a key and make the row for that key LOW.

By periodically strobing each row LOW one row at a time, and reading the column input levels during each strobe, one can determine which key is pressed.