AnsweredAssumed Answered

cFree Counter Basics

Question asked by David Grimes on Aug 21, 2014
Latest reply on Sep 5, 2014 by David Grimes

I am seeking to clarify just how the Free Counter bean works with the Timer. I am still working on measuring two asynch frequency signals. I am using two Capture beans but to control timing of the calculations needed for the device to function I have added a Free Counter. All of these need to share TPM1 of the QD4 micro (its the only one available.)

 

My three ISRs look like this:

On_Capture1

if(FC1_GetCounterValue(&time) == ERR_OK)

{

if(Signal1_overflow <1)

{

Signal1_period = time - lasttime1;

lasttime1 = time;

}

}

 

On_Capture2

if(FC1_GetCounterValue(&time) == ERR_OK)

{

if(Signal2_overflow <1)

{

Signal2_period = time - lasttime2;

lasttime2 = time;

}

}

 

FC1_OnInterrupt

{

Signal1_overflow++;

Signal2_overflow++;

.../* Error traps for too many overflows */

Calculate = TRUE;

}

 

Ocassionally Signal1 and Signal2 ISRs coincide, which is when the calcualtions start to show errors. How does FC1_GetCounterData differ fom Capture1_GetCaptureValue?

 

Thanks,D

Outcomes