Yes, the timer runs continuously.
do not know how the timer-0 and input capture works, is the timer-0 running continuous in this mode and measures the time between ptd6/tpm0 active edges??
Only if you have overflow-interrupts enabled. The interrupt-enables for the free-running timer and each timer-channel are independent.
if this is the case I may also expect timer overflow irq's?
There are many ways, but it is one of the easiest ways. If you have a TBM module in your micro, that is an easier way.
is the overflow irq for timer-1 general time delay the only method to generate a general delay on timer-1???
Actually, there should be independent timer overflow interrupt enables for each timer. AFAIK, the two timers are completely independent.
the overflow irq on/off enable is a global function and effects both timer-0 & timer-1.
Hi jah,
Your device only has 1 timer with two channels.
It doesn't have a TBM.
So there is only one counter to rollover, so 1 overflow bit/interrupt.
You will use 1 channel as your IRQ, in the interrupt handler read TPM1CxSC (x depends on channel you use) then clear bit 7 of it. Now you can do what you wanted.
This will still allow you to use the timer and the other channel for other purposes as you have not interfered with the timer at all.
Think of input capture as a very fast bundy clock (the clock used to check when emploees of a factory start/stop work in case this word is not universal).
You clock on at 11am (11am recorded on card)
Clock "rolls over" once at midday
Clock "rolls over" a second time at midnight.
You clock off at 2am (then resign because hours are too long) (2am recorded on card)
So you have worked for 1 period - 12hours
plus 1 hour before and 2 hours after = 15hours
This is exactly how the timer works and how you have to interpret the results.
You can configure the spare channel to clock on/off accurately or just read the timer for rougher timing.
You can use an interrupt to count the rollovers or just poll the overflow bit.
If you just want the pseudo IRQ ignore rollovers.
Hope this helps
Regards David
Message Edited by rocco on 2006-08-17 03:03 PM
Hi jah,
Didn't study setup in detail but...
If you enable overflow interrupts then you will get ints if the timer is running irrespective of the state of any pins (except RESET )
If your just trying to make an IRQ pin just enable input cature, then in the interrupt handler do what you have to to clear the cause then do what you were going to do in your IRQ.
Regards David