2014-06-29 5:32 PM
Can I have a link or an code example to count the rising edges that have an input signal in a prefixed time?
I need the number of rising edges in a second.The frequency of the signal on a gpio input is in a range from 10 Hz to 70Hz.how count the number of rising edges until the timer is 0?I use stm32f4 discovery.2014-06-29 8:15 PM
You could use one TIM in external counter mode, and use a second to define the integration period, this could trigger a DMA sample of the counter of the first, and subsequent measurements would allow you to compute the increments over the period. There may also be other gating options.
2014-06-30 1:46 AM
Can I ask you an example?
2014-06-30 1:47 AM
2014-06-30 7:52 AM
There are several manuals for it, Data Sheet/Manual and Reference Manual. The timer section is a bit heavy going, but if you have familiarity with other micro-processor and timer designs it should give some perspective.
http://www.cs.indiana.edu/~geobrown/book.pdf
I don't really want to have to write everyone's code. I've posted some external counter examples. You could review the count every 1000 iterations of a 1ms SysTick interrupt? The kind of frequency you're talking about would seem easy to measure using PWM Input mode. Integration is perhaps more effective with faster clocks.We’re moving the ST Community to a new platform to give you a better and more reliable community experience.