Versions Compared

Key

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

...

The following example installs a cyclic called function AppCyclicFunc() to the CANopen node AppNode. The timed function will be called the first time after 10ms and then every 25ms with the parameter 0xcafe.


Code Block
languagecpp
    CPU_INT16S  aid;
    :
    aid = COTmrCreate(&(AppNode.Tmr), 10, 25, AppCyclicFunc, 0xcafe);
    if (aid >= 0) {
        /* tid holds the timer identifier */
    } else {
        /* error during creation of timed action */
    }
    :


Note: The example assumes, that the application callback function AppCyclicFunc() is implemented with the correct prototype. The configuration setting CO_TMR_TICKS_PER.SEC is assumed to be 1000, e.g. 1 tick is equal to 1ms. See CANopen Config Manual for details.

...