Searching \ for 'Keypad Decoding ][][' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/index.htm?key=
Search entire site for: 'Keypad Decoding ][]['.

Truncated match.
PICList Thread
'Keypad Decoding ][]['
1999\01\10@064144 by paulb

flavicon
face
Greg Cormier enquired of me:

> Chords won't be needed for my application. BUT, if someone does hit a
> chord, is it possible for the PIC to think they've only hit one key?

 Most cerainly; if you use a "first match" algorithm of whatever type.

 The big conundrum is what you want to do for a multiple keypress;
whether to ...

1} call it invalid (and if so, do you wait till it becomes "valid" or
just wait until *all* keys are cleared?).  Called "zero key rollover".

2} call it the first key and wait for it to be released (*then* either
wait until all others are released, or recognise the next key found).
Called "one key rollover" or possibly "2-key rollover".

3) call it the first key, debounce that then "lock it out" until
released, proceed to the same for the second or all subsequent keys.
Called "two key rollover" or "N-Key rollover" respectively.

 Regarding my comment about "first match" algorithms; the scan along
either rows or columns is usually a shift register operation.  (You may
use a table lookup instead, but the table tends to be *large*!)  If you
complete the operation (jump out of the loops) when the first contact is
detected, that is "first press".  You then derive a code for the key and
repeat the process during the debounce interval until the same code is
seen every time.

 The alternative is to generate two arrays to map all keys, "old" and
"new".  To begin, "old" is copied to "new".  If on scan, the keys differ
from "new", then they are mapped into it, and the count (debounce) flag
*initialised* with the desired countdown value.  Every time the keys
differ from "new", this is performed again.

 Every time however, they match, the count is decremented.  When it
reaches zero, then the (first) key in "new" is recognised by comparison
with "old"  To "remember" that it has been recognised, this bit is
copied to "old" and further comparison of "new" and "old" made to look
for others.  Perhaps not immediately; this is often performed by a state
machine which *starts* by comparing "new" and "old" and performs one
scan per invocation.

 When "new" and "old" match, the debounce flag is set to "idle" (-1) in
which state it is *not* decremented if the current scan matches "new".
What I failed to mention just here is left as a teaser.

 This algorithm is for "N-key rollover", but may be used if desired for
the simpler approaches.

 Fair enough?
--
 Cheers,
       Paul B.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...