piclist 1997\08\15\161340a >
Thread: key matrix scanning
www.piclist.com/techref/index.htm?key=key+matrix+scanning
picon face BY : John Payson email (remove spam text)



> somebody please tell me whether a
> X-Y key matrix is efficient, if i
> am checking for key combinations
> rather than single-key presses.
> i ask because the 16c84 has only 1k
> of code space, and key matrix
> scanning consumes a lot of space.

Matrix scanning doesn't have to use a lot of space; it depends what you're
looking for.  If you have, e.g., a full 4x8 matrix and you want to look for
all possible key combinations (and you've put in diodes as needed) your best
bet is probably do do something like this:

       movlw   1
       movwf   PORTA
       call    Delay
       movf    PORTB,w
       movwf   ROW0
       movlw   2
       movwf   PORTA
       call    Delay
       movf    PORTB,w
       movwf   ROW1
       movlw   4
       movwf   PORTA
       call    Delay
       movf    PORTB,w
       movwf   ROW2
       movlw   8
       movwf   PORTA
       call    Delay
       movf    PORTB,w
       movwf   ROW3

Twenty words of code space (plus the delay routine); 4 bytes of registers.
Doing a decent debounce would probably require another 4 bytes; a better
debounce (if you're calling the routine often enough to require one) would
probably take 8 to 16 bytes.  Note, btw, that you can replace the "delays"
above with debounce code if desired (which will take a few microseconds to
execute, giving the next keyboard row time to settle).

Is the above approach too register-hungry for you, or are you looking for
something else?
<199708152000.PAA22083@Jupiter.Mcs.Net>

In reply to: <9708151818.AA00759@shakti.hal.com> from "Ravindra Divekar" at Aug 15, 97 11:18:47 am
See also: www.piclist.com/techref/index.htm?key=key+matrix+scanning
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) key matrix scanning

month overview.

new search...