2013-11-26 12:50 PM
Hello,
I want to measure the frequency of an input pwm signal. To do so, I've examined the TIM/InputCapture example. In this example, as long as the signal comes in, the program generates interrupt. But, I need to measure the frequency just once when I triggered a pushbutton. Is it possible to do that? If so, how can I do?Thank you.Anil #pwm-input-capture2013-11-26 01:50 PM
Enable the interrupt when you get the button press, disable it once you have the measurements you need.
2013-11-26 02:09 PM
Good approach indeed, thank you for reply. But, I've been thinking if i get just one result. When I press the button, I will get the results along few miliseconds more or less. Is it possible that I get only one result at rising edge of trigger?
2013-11-26 02:27 PM
I'd honestly think you'd need multiple measurements, not least for the reason that you don't know if the button push is coherent with the input signal. The latency to getting a good measurement will depend on the frequency of the signal you are attempting to measure.
The other method would be to keep measuring all the time, and simply latch the current one at the button press.2013-11-26 02:40 PM
I understand. That's very helpful, thank you.