cancel
Showing results for 
Search instead for 
Did you mean: 

EXTI line got odd/even interrupts count.

EYang.11
Associate II

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!

2 REPLIES 2
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
EYang.11
Associate II

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,