PWM input capture to measure fan/pump speed

Discussion to talk about software related topics only.
Post Reply
zoanie
Posts: 13
Joined: Mon Apr 11, 2011 10:42 pm
Location: Thousand Oaks, CA

PWM input capture to measure fan/pump speed

Post by zoanie »

Hi,
I would like to use the MOD545515 PWM input capture capability. I'm looking for an application note that or other reference that may already have software for this feature. The idea is to use the PWM I/O pins to measure the period and pulse of a set of input signals. The input signals are from a set of fans and pumps. I should be able to measure the RPM of the target fans and pumps. I found the relevant section (see below) in the MCF5441X Reference Manual to start trial and error coding, but it would be nice to find out the problem has already been solved.

MCF5441X Reference Manual, Rev 4:
34.4.6 Enhanced Capture Capabilities (E-Capture)
When a PWM pin is not used for PWM generation, it can perform input captures. Recall that for PWM
generation the edges of the PWM signal are specified by separate compare register values. When
programmed for input capture, both of these registers work on the same pin to capture multiple edges,
toggling from one to the other in a free-running or one-shot fashion. By simply programming the desired
edge of each capture circuit, the period and pulse width of an input signal can easily be measured without
the requirement to re-arm the circuit.
In addition, each edge of the input signal can clock an 8-bit counter where the counter output is compared
to a user-specified value (EDGCMP). When the counter output equals EDGCMP, the value of the
submodule timer is captured and the counter is automatically reset. This feature allows the module to count
a specified number of edge events, and then perform a capture and interrupt.

Any help would be greatly appreciated,

Thanks

Carlos Navarrette
Post Reply