# Keypad to set a counter

Is there a way to use a standard Matrix Keypad to set a synchronous counter IC without having to use a micro controller?

What are you looking at the counter to do, and what relationship do you expect between button position on the grid versus the count value? If you have a counter that produces a one-hot active low output (all other signals driven high), one could connect each output to a diode which would pull down the keypad row assigned to that count (put pull-ups on all keypad rows), as well as to the emitter of a dedicated NPN transistor whose base was connected, via resistor, to the column assumed to that count. Tying all the emitters together and attaching a pull-up will yield a signal which goes low whenever a button is pushed which doesn't correspond to the present count.

If one's goal is e.g. to build a timer which can be pre-set for 1-9 minutes by pushing a button, one could use a 74HC17 wired as above, wired to the bit 5 of a counter which is fed by a 555 that normally ticks 64 times per minute, but can be accelerated to run many times faster. Net circuit requirements would be about ten transistors, nine diodes, about couple dozen resistors, a few caps, the 74HC4017, a counter (a 74HC4040 would be fine), and a 555.

Here's a generic logic diagram for scanning a matrix keypad; I'll leave it up to you to translate it to your favorite implementation technology, which could be anything from SSI/MSI logic to a CPLD to part of an FPGA.

simulate this circuit – Schematic created using CircuitLab

This circuit scans the keys, one at a time, at a 1 kHz rate. When a key is pressed, the output of the multiplexer goes true and triggers U5. U5 is retriggerable, which means that its output remains true for as long as its input is true, plus another 10 ms or so after it goes false. This serves to debounce the keypresses. The QN output stops the scanning as long as a key is held down, and the Q output (data strobe) indicates to the external logic that the key location is available on the data out lines.

Ideally, you arrange the keys so that their locations are also the values you want them to represent; otherwise, use a lookup table to translate.

Note that U5 could be an analog multivibrator if you're using SSI/MSI logic; or it could be a digital counter driven by the 1 kHz clock if you're using a CPLD or FPGA.

Sure, if you're willing to put up with obsolete components.

The 74C922 and '923 are 4x4 and 4x5 keypad matrix controllers. They strobe a signal when a valid keypress is detected, and then output the binary equivalent on 4 or 5 pins.

Both have been obsoleted, and there are no direct replacements available. All current replacements either are a MCU or require one due to their use of I2C.

• We were scanning matrix keypads long before the specialized ICs came out; it isn't difficult. I wouldn't do it with SSI/MSI logic like I used to; I'd probably use a CPLD or part of my FPGA to do it. Feb 10, 2015 at 20:17
• shrug If the asker doesn't want to use a MCU then I don't really see a CPLD or FPGA in their future either. Feb 10, 2015 at 20:19
• That wasn't the point. You seemed to be suggesting that obsolete chips was the only way to get it done, and I'm saying that it can be done with any sort of SSI/MSI logic (but that I wouldn't personally do it that way myself). Feb 10, 2015 at 20:26
• I just found out about 10-4 line priority encoders. Can't I just use one of those to translate keystrokes to BCD, then load that onto the counter? Feb 12, 2015 at 20:39
• If you can find a line-per-key keypad, sure. But most use matrix arrangements. Feb 12, 2015 at 20:45