2 Attachment(s)
Oscillo - readings not clear to me
Hello,
As buttons present some difficulties with PICs (bouncing issue), I thought I could try to improve the situation by adding a kind of RC filter (Button_shematic.JPG).
I have connected my oscillo to the circuit and started measurements.
As I am not an expert, I have difficulties to understand what I am reading (I know, it sounds stupid but the oscillo's help file doesn't really help...).
I have setup the oscillo to trigger one button press (at least I think I did so).
Does someone feel comfortable with oscillos and tell me what this trace (Oscillo_Button.JPG) says?
WHILE/WEND is sometimes a blocking solution
I have made a timer using the TMR0 interrupt.
With the settings I use, I can't PAUSE for more than 16ms or I'll miss a tick.
So I have to slice a
PAUSE 50
in
PAUSE 10 : PAUSE 10 : PAUSE 10 : PAUSE 10 : PAUSE 10
But this is not a problem.
I have already used the WHILE/WEND loop followed by a PAUSE. And here, some problems occur from time to time.
I'm not absolutely sure but I think it can miss the "real" button state. The WHILE/WEND loop can "see" a bounce of the button and not the real state of the button you actually want it to have. It may not have the desired effect.
Moreover, this WHILE/WEND loop is a blocking loop since it will prevent the PIC to give the hand to the Interrupt as long as the button is pressed.
I would really prefer some kind of interrupt scanning for a raising/falling edge of I/O ports with an internal routine preventing consecutive (bouncing) inputs whithin a certain time frame.
Maybe something already existing in PICs, maybe something to do?
Why not Instant Interrupts
Hi,
Quote:
I can't PAUSE for more than 16ms or I'll miss a tick
Look at this: http://www.picbasic.co.uk/forum/showthread.php?t=3251