I didn't download your program, as I surf with my Mac and PBP on my PC. I would have to thumb-drive it over to look. However, the debounce procedure that works well for me it to detect a button press, then pause about 50 ms to see if it's still pressed. Then wait until it is no longer pressed, and wait another 50 ms. Something like this:
Code:
IOC_ISR:
IF PORTB.4 = 1 THEN 'Button is pressed
PAUSE 50 'Give it a chance to stabilize
IF PORTB.4 = 1 THEN 'Recheck to verify button press
WHILE PORTB.4 = 1 'Wait until button is released
END WHILE
PAUSE 50 'To give any rogue static bounces a chance to fizzle
'Take Action Based on Button Press
ENDIF
ENDIF
I've been coding in XC8 for the past couple years. My PBP is getting a bit rusty. Forgive me if my syntax isn't correct, but hopefully you get the gist of what I'm trying to accomplish.
Bookmarks