2020-12-21 10:51 PM
Hi friends,
I met a problem.
I used one EXTI line to check a button push-and-release. EXTI line was set to be triggered by both falling and raising edge.
I know there will be burr when I pushed the bottom. The question is , when I pushed and then released button, the count of interrupts are some times odd and some times even. As to my understanding, it should be even number since anyway, you will return to your original signal value(lets say HIGH). For example, if you have 2 burr in a push-release, you should have 4 times interrupts(HIGH(origin)->LOW->HIGH->LOW->HIGH). I could not understand why.
Thanks for your help!
2020-12-22 06:18 AM
Buttons are electrically noisy. If you press a button once, there are typically tens or hundreds of state changes on the line. Look up button debouncing to understand and address this.
If an ISR tries to trigger twice in a very short period, it will only be called once. This is likely how you're losing edges.
2020-12-22 09:13 PM
Thanks for your reply. I will check the behavior of pushing button with a Oscilloscope. I just did not expect so many bouncing and so fast. Thanks,