One-shot Counter/Timer operation on LPC1347

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by mathseng on Fri Dec 05 01:58:40 MST 2014
I am trying to find out how to use the Counter/Timer on the LPC1347 as a one-shot, and cannot find the references in the User Manual.

Specifically, I have a signal on the CT16B1CAP0 input, and want to use the timer in one-shot mode.

I have tried using the standard ISR model, capturing edges and interrupting, however, this consumes far too much CPU for higher (200KHz) signal frequencies.

Can anyone assist, please?

For the interested:
The scenario is to measure the duty cycle of a 200KHz signal. The first code developed was for a 20KHz signal, with both Rising and Falling edges captured in an ISR and retrieved using a task under FreeRTOS. Even at 20KHz, some edges were missed in an application with FreeRTOS, USB_HID, I2C  and ADC interrupts all running at the same time.
The revised hardware now uses a 200KHz PWM signal. The old algorithm just doesn't work. A fiddle and another algorithm allows PWM calculations for higher frequencies (tested at up to 2MHz signal (accuracy between 3 - 10% @ 2MHz)), but there are lots of assumptions, so results are approximate.