piclist 2003\04\09\174345a >
Thread: different approach to keyboard scanning?
picon face BY : Michael Park email (remove spam text)

A few years ago there was a very interesting thread on using n I/O lines to
control n(n-1) LEDs with no additional ICs.  I'll describe the method below,
but you should really look up the thread to get all the clever bits ('Loads
of flashing LEDs', 1998/07/18).

My question is this: Can anyone see how this technique might be applied to
scanning a keyboard matrix?  My application would require full n-key
rollover.  I know how to do it with an extra chip, like a 74138, but I
thought it would be a neat challenge to adapt the LED approach.  I had one
crazy idea, but apparently it was not just crazy enough to work.  More on
that later.

Anyway, here's the 'Loads of flashing LEDs' technique:

For concreteness, imagine a 4x4 matrix where the four rows go to four I/O
lines and the four columns do too.  Put 12 LEDs at the non-diagonal
junctions with the anodes connected to the columns.

   0   1   2   3
   |   |   |   |
   |   |   |   |
1--LED--+--LED-LED-    4 lines, 4(4-1) = 12 LEDs
   |   |   |   |
   |   |   |   |
   |   |   |   |

You can turn on any LED at will.  For example, if you bring line 0 high,
line 1 low, and make lines 2 & 3 hi-Z inputs, then the top LED in the first
column will light up.

Even though there appear to be multiple current paths, only one path has one
LED, and once it lights, the others won't reach their threshold voltage.
Pretty cool, huh?

Now I'll go into my ideas for turning this into a keyboard scanner.  I'm a
total amateur at this, so be warned: this may unintentionally cause you to
snort derisively.

What I'm thinking is you'd replace each LED with a switch and diode.  One
way to sense the state of the top switch in column 0 would be to output a 1
on line 0 and read the input on line 1.  This would detect single switch
closures.  However, multiple closures can cause ghosting and masking, even
though each switch has a diode, because the row and column wires are

But note: any sneak current paths from line 0 to line 1 (say) will go
through more than one diode; only if the switch at column 0, row 1 is closed
will there be a path with just one diode.  If only there were some way to
distinguish between the one-diode case and the more-than-one-diode case...

So my crazy idea was to drive line 0 high and line 1 low, then read the
state of line 0 (which, on the PIC, is supposed to reflect the actual
voltage on the pin, IIUC).  My hope was that the input thresholds would be
such that with one diode, line 0 would be about 0.7V and would read 0, while
with two (or more) diodes, line 0 would be 1.4V (or more) and would read 1.

Unfortunately, it didn't work.  Even with just one diode, I couldn't get
line 0 to read 0.  Sigh.

Hence this missive.  Hoping better minds will have better ideas.


Help STOP SPAM with the new MSN 8 and get 2 months FREE*

http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

See also: www.piclist.com/techref/index.htm?key=different+approach
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) different approach to keyboard scanning?

month overview.

new search...