Keypad is commonly found in medium digital electronics control system – such as door lock, electronics calculator, etc.
Keys are arranged in matrix like 3×4 or 4×4 array. It need a microcontroller program to scan and get the present of key pressing. A single 8-bit microcontroller port is suitable for keypad scanning.
An 8-bit AT89C52 MCS-51 microcontroller is easily interface to this key matrix. Using C in Keil uVision makes this keypad scanning program more easily. Lower (row) and higher (column) nibble of microcontroller port are combine together to scan and find any key pressing.
Lower nibble (row) P2.0 to P2.3 in digital output while the remaining is digital input.
The schematic shown below is a system that contain a keypad matrix and its output, representing any key-press. Output is a single 7-Segments display in common cathode type.
Key number of this scanning program is 16, ranging from 0 to 15. An optional seven-segments display code decodes this key number to displaying data.
With the advantage of C in Keil for 8051 microcontroller, the overall program is easy to understand and short.
Click here to download this example program.
No comments:
Post a Comment