I have a project using CW IDE 5.7.0 and PE v2.98, I'm developing on an MC9S12C64 @ 32Mhz (timer is running at 1Mhz, 1uSec per tick)
I have been working fine using FreeCntr and TimerInt beans. All of my time beans operate in free run mode (do NOT reset on compare).
Now I want (need) to start counting timer overflows. I have some calculations that are triggered by an external interrupt and use the TCNT value and it is possible in some cases that I can have MORE than 65ms pass between the external interrupts. So I now want to process the overflow as an interrupt and simply count the number of overflows between my two external triggers. See explanation below.
The problem is that there does not seem to be, in any of the FreeCntr or TimerInt beans a way to specify an overflow handler. I DID find the low level Init_TIM bean - however, when I add it, I get conflicts with my current counter beans, even though the way I'm using the timer beans does NOT conflict (and I have no TIMER modules enabled in the Init_TIM bean). ALL I WANT TO DO IS ADD AN OVERFLOW INTERRUPT HANDLER and ENABLE OVERFLOW INTERRUPTS.
I really don't want to throw away all my FreeCntr and TimerInt beans and start from scratch with the Init_TIM bean. Not only does that mean rewriting code, but I also loose the higher level access functions (e.g. GetCounterValue). I can still do all the stuff, but with the Init_TIM bean I have to do ALL of the stuff.
Bottom line - if I am using FreeCntr and TimerInt beans, is there ANY WAY to add a timer overflow handler.
Here is the reason I need this:
I have an external item that causes an interrupt, then based on internal calculations, using the FreeCntr, I have to create pulses relative to the interrupts. At some times, the time between the external interrupts can be greater than 65535uSec so I need to count the overflows, then add the difference between the original counter value and the current. At the same time, I use the TCNT value, plus some calculations to setup an OutputCompare on the timer so I can trigger the start, or end of a pulse.
trig1 | | ovfl1 ovfl2 trig2
In this case, I would store TCNT at trig1. At trig2, I get the time and I need to check if any overflows have occurred...
For just one overflow, elapsed time is (65535 - trig1) + trig2
for each additional overflow, I must add a multiple of 65535, in this example the multiplier is 1.