EmbeddedRelated.com
Forums
The 2026 Embedded Online Conference

LPC24xx Toggling between Timer and Capture Functionality

Started by sns22 January 7, 2016
Hi all,

I am working with LPC 2468 in an embeddedartists board.

In my design I am interfacing to 8 PWM capture based sensors(PT100 using
UTI and Max sensor).
To achieve it I used the 2 PWM captures and 6 timer (T1 T2 T3 CAP 0&1)
captures. (all are hard wired )

But now I face a design complexity where I have no free timers to be used
for adding delay in the main code. T0 is being used for Ethernet uip
code.

I had an idea to toggle between timer and capture functionality in
software. All the capture signals are hardwired on the board. But this is
not working. When I turn on the timer functionality and turn it off later
it messes up with the counter in the sensor.

Is there a way to do it where one can switch in software between timer and
capture functionality. My sensor capture code does not use the timer from
the same line.

For eg:: My idea was to use Timer 1 while using cap functionality of Timer
2 and to use Timer 2 while using the capture functionality of Timer 1.

I set PCONP_bit.PCTIM1 ,2,3 = 0 at the end of the capture code. I also
reset the PINSEL = 0 after the capture code is finished.

Am I missing something here??

Cheers
---------------------------------------
Posted through http://www.EmbeddedRelated.com
On Thu, 07 Jan 2016 09:49:48 -0600, sns22 wrote:

> Hi all, > > I am working with LPC 2468 in an embeddedartists board. > > In my design I am interfacing to 8 PWM capture based sensors(PT100 using > UTI and Max sensor). > To achieve it I used the 2 PWM captures and 6 timer (T1 T2 T3 CAP 0&1) > captures. (all are hard wired ) > > But now I face a design complexity where I have no free timers to be > used for adding delay in the main code. T0 is being used for Ethernet > uip code. > > I had an idea to toggle between timer and capture functionality in > software. All the capture signals are hardwired on the board. But this > is not working. When I turn on the timer functionality and turn it off > later it messes up with the counter in the sensor. > > Is there a way to do it where one can switch in software between timer > and capture functionality. My sensor capture code does not use the timer > from the same line. > > For eg:: My idea was to use Timer 1 while using cap functionality of > Timer 2 and to use Timer 2 while using the capture functionality of > Timer 1. > > I set PCONP_bit.PCTIM1 ,2,3 = 0 at the end of the capture code. I also > reset the PINSEL = 0 after the capture code is finished. > > Am I missing something here?? > > Cheers --------------------------------------- > Posted through http://www.EmbeddedRelated.com
I think you may have just gone and selected hardware that doesn't have enough timers. HOWEVER: some of chips that I've used that have capture-compare functionality allow you to set the timer to free-run, and interrupt you on a roll-over. Then the capture function just snags the timer count on an external event. If you just need a heartbeat, then you could use the roll-over as your heartbeat, and use the capture-compare functionality separately. Alternately, the part number sounds ARM-ish -- can you use the core timer for Ethernet, and the hardware timers for whatever it is you're doing? -- www.wescottdesign.com
The 2026 Embedded Online Conference