Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

COTmrService

Description

This function updates the timer states. The function is used to generate a periodic time base and must be called cyclic.

...

The following interrupt service function generates the time base for the CANopen timed actions with periodic calls of the function COTmrService(). When using a RTOS, the return value may be used to decide of triggering a separate timer task to process the elapsed events.


Code Block
languagecpp
void HardwareTimerISR (void)
{
    CPU_INT16S num;
 
    num = COTmrService(&AppNode.Tmr);
    if (num > 0) {
        /* post an event to the timer processing task */
    }
}


Note: The configuration setting CO_TMR_TICKS_PER.SEC is assumed to be 1000, e.g. 1 tick is equal to 1ms. Therefore the hardware timer must be setup to generate an interrupt every 1ms. See CANopen Config Manual for details.

...