Page 1 of 1

Input capture unit - counting external pulses

Posted: Sun Nov 30, 2014 3:23 pm
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

Re: Input capture unit - counting external pulses

Posted: Sun Nov 30, 2014 5:42 pm
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