keypad scanner

Jun 03, 2005 5 Replies

Hi all,



I am implementing a 6x6 matrix keypad scanner in CPLD. My requirment is i should detect multiple key presses also. What i am planning to do is , i will scan the rows (6 of them sequentially) , when all the 6 rows are scanned i will send the 36 bit output(each bit corresponds to each individual key .'0' indicates pressed)to the controller.The scan rate for each row is approximately



32 msec , so every 32x6=192 msec i will be sending the 36 bit code to controller(HCS12).

I want your comments on this implementation in CPLD.



Regards, Praveen



Homework ?

You will need Opendrain OPs on drivers, and pullups on IPs.

exercises: a) If you use a MATRIX, what are the sense limits on multiple key presses ? Start by considering 4 closed keys, one in each corner.

b) Would a user find 0-192ms slow/erratic on a keypad response ?

-jg

With or without diode isolation per key?

Or four keys pressed along a diagonal. How does the chip determine which keys are pressed? Without diodes, it appears 16 are pressed.

With diode isolation, if the OP wants it to work!

The homework question is good, this (even with N-key rollover, or a bitmap of all keys pressed, generated fast enough, every 10 mS or so) is more easily done with a microcontroller with appropriate I/O, eliminating the CPLD. Some chips like the Motorola (er, Freescale) have input ports configurable so that any of the 8 lines going low can cause a processor-wakeup interrupt, giving very low overall power consumtion. Doing key scanning in a CPLD seems like a design exercise rather than a practical application.

-----

formatting link

Are you sure? Can you explain?

Well, it might vary depending on how the output port feels about having shorted output, but let's assume, both for the simplest explanation and to prevent hardware damage, that the outputs going to the key matrix are open-collector (or thesedays, open-drain), meaning when the processor sets the output state high it can 'float' high or low, but wnen it's low it's pulled low. Suppose you have a 4x4 key matrix, and the four horizontal lines are driven by open-collector outputs, and pulled high by resistors. The vertical lines go to microcontroller port inputs. Now that I think about it, I posted too soon...the matrix would sense diagonally-pressed buttons just fine. I was imagining something that would short out the whole matrix, and that won't do it.

Quoting the first response

Here, if you press any three keys forming three corners of a rectangle (without diodes), the processor will also "see" the fourth corner pressed, as the wires to it will have an electical connection through the other three switches. This is the sort of problem I was thinking of.

-----

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required