This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/LAUNCHXL-CC1312R1: How to calculate the delay of evhSetupTimer1Trigger()

Part Number: LAUNCHXL-CC1312R1

Tool/software: Code Composer Studio

Hi,

Sorry I can't understand the help document of evhSetupTimer1Trigger().

I found some example about 200ms delay and 750us delay

    evhSetupTimer1Trigger(0, 3, 0); // 750 us

    // Start 200 ms debouncing interval
    evhSetupTimer1Trigger(0, 200, 2);


and what is "The timeout is rounded up to the closest number of 4 kHz ticks" mean?

I try to calcucate the 750us example, 3*2^0 = 3 clocktick = 3/65536 = 45us, not match...

Thanks.

  • Hi Chris,

    From the evhSetupTimer1Trigger documentation in the Help Viewer:

    evhSetupTimer1Trigger

    Prototype: evhSetupTimer1Trigger(#evIndex, mant, #exp)

    Sets up AUX Timer 1 to trigger execution of the Event Handler Code after a specified delay.

    The timer runs off 4 kHz ticks (4096 Hz) generated by the RTC. Note the following limitations:

    • The timeout is rounded up to the closest number of 4 kHz ticks
    • The 4 kHz tick rate is matched to the RTC rate, which may be adjusted dynamically if running off RCOSC LF

    The trigger occurs after the delay. The specified Event Handler Code then starts when the Sensor Controller is idle or in standby.

    Parameter value(s)

    • #evIndex - Event index to be triggered
    • mant - Delay mantissa value (1-65535). Resulting delay is mant * 2^exp [4 kHz ticks].
    • #exp - Delay exponent value (0-15). Resulting delay is mant * 2^exp [4 kHz ticks].

    So, the 750 us example would be as follows: 3 * 2 ^ 0 / 4096 = 732 us

    Note that you only get a certain amount of resolution at such small time intervals.