Input capture unit - counting external pulses

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
ncoage
Posts: 3
Joined: Wed Nov 26, 2014 8:53 pm

Input capture unit - counting external pulses

Post by ncoage »

Hello,

I'm working on a project where I have to measure a speed of rotation of a wheel. I'm using simple "light barrier crossing" circuit, so it gives one pulse per revolution.
What is the best option to choose to measure that? I tried ICU driver by using the "last period" measurement. But I guess the driver counts internal pulses (generator prescaled to give 10000 Hz) gated by external signal (coming from my circuit).
Is there an option to count external pulses gated internally, for example - for every 20 ms it will return the number of input pulses?

Best regards
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Input capture unit - counting external pulses

Post by Giovanni »

Hi,

The ICU driver is not done for that, you need to access a timer at register level and use it as upward counter. Using a virtual timer you can get the count and reset it every 20mS.

Giovanni
Post Reply