Input capture channels required

26 Jun 2009

it would be useful to have an input capture facility on the MBED module also. Most of the timers currently mapped onto the I/O have an input capture facility. this is useful for measuring rotation speed of motors etc.

We have a DC motor speed control module that fits the RSEDP that we have maped to the mbed module. We require a input capture channel to capture the rotation speed. This typcailly gives one or two pulses per revolution. A 3000 RPM motor for example would generate a 50Hz input to this pin.

 

Best Regards

David Giles

 

26 Jun 2009

Hi David,

As you probably know there are timer capture pins on the LPC2368... are any of the useful ones available on DIP pins? If so, what sort of abstraction model would make sense for this sort of application?

I've previously used a DigitalIn rising and falling interrupt handlers to start and stop the timers, thereby measuring the low and high periods. Is this method usable for what you are doing?

The timer isnt written up in the Handbook yet, but you can see it's API at :

http://mbed.co.uk/projects/libraries/api/mbed/trunk/Timer

Hope that helps,

Cheers,
Chris

29 Jun 2009

Yes there are two pins we would like to make use of. These are pin 29 and pin 30 on the DIP40 connector. They are shown as CAN Rx and Tx but they have alternate functions are input capture for Timer 2.

CAP2[0] — Capture input for Timer 2, channel 0. 
and
CAP2[1] — Capture input for Timer 2, channel 1. 

It should therefore be possible to read the input capture value of the timer directly from the input capture register.
We have a relatively slow moving signal, 50Hz input for 3000 RPM. So even a high speed spindle at 10,000 RPM will only generte a signal of 167Hz from a hall sensor input.

In terms of building a API we would call a function something like

return_rpm = measure_rpm(0)
or
return_rpm = measure_rpm(1)

where the 0 and 1 are the timer channel numbers and the return value is a 16 bit unsigned integer in RPM.
A float could also be used as a return value.

We have mapped the RS-EDP motor drive module tacho feedback pin to these two pins above via a link option on the adapter module.