Hi,
PBP takes care of your button debouncing problem. Use the BUTTON function. Besides debouncing it also does some neat autorepeat for you when use it in a loop.
Hi,
PBP takes care of your button debouncing problem. Use the BUTTON function. Besides debouncing it also does some neat autorepeat for you when use it in a loop.
Regards
Sougata
The oscillo trace show you exactly what is suppose to happen with any mechanical push-button.
theory and explanation bellow
http://www.elexp.com/t_bounc.htm
Solution... there's many different. Using PBP BUTTON command, use Timers interrupts, OR use a simple loop
Code:PushButtonA VAR PORTA.0 ' ' ' ' IF PORTA.0=1 THEN ' Do your Stuff ' WHILE PORTA.0=1 : Wend ' wait untill push button is release PAUSE 50 ' Debounce delay ENDIF
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Good information.
If I don't like to use the BUTTON command or WHILE/WEND artifices, it's because of this short pause that has to be artificially created to avoir the bouncing.
It sounds silly but I like to hear the button's "click" and see the display (or LED or any other action) react at the same time.
Instead of waiting for the button to debounce, wouldn't there be a solution to use the only the very first raising/falling edge of the signal and make the PIC ignore the following pulses for some milliseconds meanwhile it exectues the program?
Roger
Well, that's what my previous example did?
It read the Button, then 'Do your Stuff' And wait untill you release the button. then debounce it.
If you released the Button before your 'Stuff' is executed, it will just execute the PAUSE 50. No harm at all.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks