DSPRelated.com
Forums

qt_sState structure

Started by TA1T August 5, 2003

I am using callbackOnCompare in the qt_sState structure for the quad
timer. Could somebody explain how the callbackoncompare works, and
also what InitialLoadValue does in relation to the following
structure.

const qt_sState XXXXXX = {

/* Mode = */ qtCountBothEdges,
/* InputSource = */ qtPrescalerDiv128,
/* InputPolarity = */ qtNormal,
/* SecondaryInputSource = */ 0,

/* CountFrequency = */ qtRepeatedly,
/* CountLength = */ qtPastCompare,
/* CountDirection = */ qtDown,

/* OutputMode = */ qtAssertWhileActive,
/* OutputPolarity = */ qtNormal,
/* OutputDisabled = */ 1,

/* Master = */ 0,
/* OutputOnMaster = */ 0,
/* CoChannelInitialize = */ 0,
/* AssertWhenForced = */ 0,

/* CaptureMode = */ qtDisabled,

/* CompareValue1 = */ 0,
/* CompareValue2 = */ 0,
/* InitialLoadValue = */

/* CallbackOnCompare = */ { qtimer_CallbackOnCompare, 0 },
/* CallbackOnOverflow = */ { 0, 0 },
/* CallbackOnInputEdge = */ { 0, 0 }
};



Hi CJ,

The CallbackOnCompare is an interrupt that occurs when the
CompareValue2 is reached when counting down (in the structure sample
you have below). The InitialLoadValue is the value loaded when the
timer is initialized either by a compare or by a different "Master"
timer. In your sample structure the timer will never initialize
because the CountLength is set to qtPastCompare so the counter will
keep counting 0, 0xFFFF, 0xFFFE, ... 2, 1, 0, 0xFFFF, ... With the
CallbackOnCompare set up you will get the interrupt each time the
counter reaches 0 and will execute your qtimer_CallbackOnCompare
interrupt service routine.

Hope this helps,
Pete
--- In , "TA1T" <cj_tait@h...> wrote:
>
> I am using callbackOnCompare in the qt_sState structure for the
quad
> timer. Could somebody explain how the callbackoncompare works, and
> also what InitialLoadValue does in relation to the following
> structure.
>
> const qt_sState XXXXXX = {
>
> /* Mode = */ qtCountBothEdges,
> /* InputSource = */ qtPrescalerDiv128,
> /* InputPolarity = */ qtNormal,
> /* SecondaryInputSource = */ 0,
>
> /* CountFrequency = */ qtRepeatedly,
> /* CountLength = */ qtPastCompare,
> /* CountDirection = */ qtDown,
>
> /* OutputMode = */ qtAssertWhileActive,
> /* OutputPolarity = */ qtNormal,
> /* OutputDisabled = */ 1,
>
> /* Master = */ 0,
> /* OutputOnMaster = */ 0,
> /* CoChannelInitialize = */ 0,
> /* AssertWhenForced = */ 0,
>
> /* CaptureMode = */ qtDisabled,
>
> /* CompareValue1 = */ 0,
> /* CompareValue2 = */ 0,
> /* InitialLoadValue = */
>
> /* CallbackOnCompare = */ { qtimer_CallbackOnCompare, 0 },
> /* CallbackOnOverflow = */ { 0, 0 },
> /* CallbackOnInputEdge = */ { 0, 0 }
> };