I am trying to measure the speed of a DC motor using IR sensor. My motor had a disc attached to it with only 1/4th part of it reflecting. I wanted to enable the interrupt at both falling and rising edge so the interrupt routine will be called twice in that 1/4th reflecting region whose distance I already know.
My ISR will enable the timer the first time around and disable it the next time the interrupt is called. The problem (which I found by studying the behavior of a variable) is that when I make the sensor react quickly, my interrupt is generated only once and not when the reflecting surface disappears. But, when I move something slowly in front of it, then both occur perfectly.
So, my conclusion is that my interrupt is not reacting fast enough.What do you think is the problem?