4 Wire Keypad Interfacing

Introduction

This describes a possible technique for interfacing a PIC to a standard 3x4 matrix keypad of the type commonly found in telephones. Interfacing these normaly requires the use of 7 I/O lines, a tricky task if your PIC has only 8 pins in total (e.g. 12C508)


Schematic

To implement this technique, some extra hardware is required over the standard solution which needs no other hardware. Six diodes are needed, these may be general purpose silicon signal diodes such as 1N4148. The schematic is shown below:


Source Code

Please note that this code has NOT been tested and is probably won't work without some tweaking. It does, however, assemble with no errors under MPLAB 4.0 The code was written for a 16F84 but should be easy ported to almost any PIC.

Get the code!


Mike Rigby-Jones. 2/12/98