If you can change the hardware, one option would be to use capacitors across the switches. Software denounce would no longer be required.
Otherwise you do do this:
port b change interrupt: detects a button press and takes action, an the end of the interrupt it sets a timer so that it will overflow in say 50ms, and then disables the port b interrupt.
when the timer interrupt goes off 50ms later it simply needs to re-enable the port b interrupt and stop the timer.
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Bookmarks