> Someone once posted a very elegant technique (or at least I thought > so). In each interrupt (since you know they'll be coming regularly) > read the state of the switch. Then rotate it into a register. In your > mainline you'll be comparing that register to a constant to determine > a button press. If you're rotating from right to left, you might want > to look for '11110000' which would represent 40ms of button pressed > followed by 40ms of button released. Not elegant enough, alas. That only works for a fully debounced signal. eg if, shifting left, you got 11010000 You would never get your 11110000 trigger pattern while having passed a valid edge. What would be valid is, for a 0 to 1 transition, to look for eg xxxx1111 which would happily allow 00001111, 00101111, 01101111 etc but you could as easily just increment a counter on every "1", reset it on every 0, and look for a count of 4 (in this case). The shifting method may be somewhat quicker than a counter. Russell -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist