Pulse Counting

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
estutzenberger
Posts: 2
Joined: Mon Apr 07, 2014 11:07 pm

Pulse Counting

Post by estutzenberger »

Hi,

We are working with a wind speed detection that simply presents pulses to the uC as it spins. Faster spinning == more pulses. Slower spinning == less pulses. For our application, we are taking a 1 minute average of the pulses. On the STM32, it is possible to set up one of the timer modules with an input capture pin as the clock source. I would like to implement this functionality under Chibi, but I am not sure which HAL module, if any, best supports this operation mode.

What would be the proper way to implement this functionality as described above?

Thanks!

Eric
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Pulse Counting

Post by Giovanni »

Hi,

There is not a specific module implementing a counter but I think it is easily implemented using the STM32 TIM timers. You could define your own "CNT" driver using the driver templates under ./os/hal/templates/meta

Giovanni
Post Reply