On Tue, Dec 27, 2005 at 12:56:59PM -0500, David VanHorn wrote: > > > > > > 8x8 matrix. This would likely be the least hardware intensive method. > > The downside is that handling all the scanning and debouncing states > > might be a bit intensive. I suppose I could simplify it by just > > treating it like 4 independant 4x4 matricies. I've never done a matrix > > this large, it's a bit daunting. > > > Why do you feel debounicng is an issue? > > Simple debounce algorithm: Here's another one that I often use. It's even simpler, though at the cost of configurability. bool old[x,y]; bool new[x,y]; bool cur[x,y] is the actual hardware inputs for each x-y if current != new new = current; if current == new old = current; potentially do a triggered action, if old != current Finally make sure this routine happens no more often then say twice the maximum frequency of bounces. The way this works is by "propegating" the values from current, to new, then finally to old. A value is never transferred to old until it's been read with the same value twice, once to store it in new, and again to store it in old. This is the method I tend to use in my PIC applications, it's very simple and only needs two bits for each switch being monitored. -- pete@petertodd.ca http://www.petertodd.ca -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist