Saturday, January 1, 2011

SCANNING KEYPAD

Keypad are available wired in various ways. If the switches are arranged in a matrix, they can be scanned by a microcontroller to see if one of the switches is closed ( i.e a key is pressed ). For 5 swiched/keys or less, it is best to use one port liner per switch/key.For 6 keys or more, a matrix arrangement is most efficient (minimize number of port lines ).

The keypad shown below has 12 switches arranged in a 4 row by 3 column matrix. Pressing a key closes a switch which electrically connects one row to one column.



Each keypad switch in the matrix is connected to the microcontroller as shown :




At the time the input port line is read, its logic level depends, first, on whether the switch is open or closed. If the switch is closed, the logic level at the input port line will be the same as the output port line logic level.

No comments: