The code I use (in C) is user run, and either falls through (returning the key being pressed) or, by uncommenting one line, stays in the routine until the key is released. The routine can be found in this C file: http://www.ubasics.com/adam/electronics/ha/ver000101/node.c search for "char scankp(void)" While it's designed for the radio shack 3x5 keypad it would not be overly difficult to modify for a 4x4 scan. The asm (with C code in comments) is here: http://www.ubasics.com/adam/electronics/ha/ver000101/node.asm It returns the key press as a 4 bit number, 0-14 in this case. -Adam Andrew Farrar wrote: > Hello, > I expect this has probably been discused before. > I am after ideas/code snippet really, my requirement is a fairly > efficient keypad routine (I have seen a few very long ones), which is > NOT interrupt driven. My own bit of software will decide at what times > it is appropriate to scan the keypad. My own software will have > multiplexed display the time period between outputting new display > data may be used for keypad debounced, so not worried about debounce, > my bit of software will sort that aspect out. > > Really after ideas for subroutine that gets key value from a 4*4 > keypad. (I will sort debounce and when to scan). > Many thanks for any help that you give. > Cheers > Andrew Farrar > andrew.farrar@port.ac.uk > > -- http://www.piclist.com hint: The PICList is archived three > different ways. See http://www.piclist.com/#archives for details. > > > > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.