External Keypad Support

The EM2001 supports both matrix and binary keypads. A typical matrix keypad is shown on the schematic diagram below:


A wiring diagram of a typical matrix keypad.

Due to flexible scan and return line mapping provided by the kp. object, you can assign any combination of GPIO lines to connect to your keypad. Up to eight scan and eight return lines can be assigned. On the EM2001, all scan line must be configured as outputs, and all return lines as inputs.

To build a keypad, you will need to have at least one return line. A sensible count of scan lines, however, starts from two! Having a single scan line is like having no scan lines whatsoever — you might just as well ground this single scan line, i.e., always keep it active:


A wiring diagram of a keypad with no scan lines.

Scan lines can optionally perform the second function of driving LEDs. One such LED can be connected to each scan line, preferably through a buffer, as shown in the diagram below. These LEDs can be used for any purpose you desire — and this purpose can be completely unrelated to the keypad itself.

If the LEDs are connected as shown on the diagram, you will turn them ON by settings their corresponding control lines LOW.


A wiring diagram of a keypad's scan lines driving LEDs.

Binary keypads (i.e., "keypads that output binary key codes") do not require scanning — they contain a (typically microcontroller-based) circuit that performs the scanning and outputs encoded binary codes of pressed keys. Such keypads are sometimes called "encoded keypads":


A wiring diagram of an "encoded" keypad.

The EM2001 can work with binary keypads incorporating up to eight data lines.

For more information see the io. and kp. objects.