cancel
Showing results for 
Search instead for 
Did you mean: 

STM32VL Discovery Input Capture Mode

anil_kirkil
Associate II
Posted on November 26, 2013 at 21:50

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-capture
4 REPLIES 4
Posted on November 26, 2013 at 22:50

Enable the interrupt when you get the button press, disable it once you have the measurements you need.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
anil_kirkil
Associate II
Posted on November 26, 2013 at 23:09

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?

Posted on November 26, 2013 at 23:27

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
anil_kirkil
Associate II
Posted on November 26, 2013 at 23:40

I understand. That's very helpful, thank you.