Scaning Matrix 4×4 Keypad With PIC16C71

Saturday, October 21st, 2017 - Digital

Hardware Scaning a matrix 4×4 keypad with PIC16C71

A 4×4 keypad can be very easily interfaced to the PIC16C71’s PORTB. Internal pull-ups on pins RB7:RB4 can be enabled/disabled by clearing/setting bit RBPU (OPTION<7>).The internal pull-ups have a value of 20k at 5V (typical). In order to sense a low level at the input, the switch is “connected” to ground through a 2.2 KOhm resistor. A key hit normally lasts anywhere from 50 ms to as long as a person holds the key down. In order not to miss any key hits, the keypad is sampled every 20 us (just after the update of the MSD).

Circuit aplication  for Scaning a matrix 4×4 keypad with PIC16C71

Scaning a matrix 4x4 keypad with PIC16C71,Scaning matrix keypad,matrix keypad 4x4,Scaning matrix keypad with PIC,Scaning matrix keypad 4x4

Software Scaning a matrix 4×4 keypad with PIC16C71

To sample the keypad, the digit sinks are first disabled. PORTB is then configured with RB7:RB4 as inputs and RB3:RB0 as outputs driven high. The pull-ups on RB7:RB4 are enabled. Sequentially RB3:RB0 are made low while RB7:RB4 are checked for a key hit (a low level). One key hit per scan is demonstrated in this program. Multiple key hits per scan can very easily be implemented. Once the key hit is sensed, a 40 ms debounce period elapses before key sampling is resumed. No more key hits are sensed until the present key is released. This prevents erroneous key inputs. The program basically inputs the key hit and displays its value as a hexadecimal character on the multiplexed 7- segment LEDs.

Scaning a matrix 4×4 keypad with PIC16C71

You may also like, related articles Scaning Matrix 4×4 Keypad With PIC16C71