CANopen Master Documentation
Version 6.06.04
|
The are a number of CANopen services which require an internal timer (e.g. Heartbeat, timer-driven PDO). The timer values for these services are set in a multiple of 1 microsecond or 1 millisecond (depends on the service).
The stack works internally with timer ticks. A timer tick has a resolution of 1 microsecond, the time span of a timer tick is set via the definition COM_TIMER_PERIOD inside the com_conf.h file.
The requested time values are converted into timer ticks and vice versa with the functions ComTmrCalcTicks() and ComTmrCalcTime() respectively.
Functions | |
uint32_t | ComTmrCalcTicks (uint32_t ulReqTimingV) |
uint32_t | ComTmrCalcTime (uint32_t ulTicksV) |
void | ComTmrSetPeriod (uint32_t ulPeriodV) |
uint32_t ComTmrCalcTicks | ( | uint32_t | ulReqTimingV | ) |
Calculate number of timer ticks.
ulReqTimingV | - requested time in microseconds |
The function calculates the number of required timer ticks (i.e. timer interrupts) based on the required time ulReqTimingV
(in microseconds) and the constant value COM_TIMER_PERIOD.
uint32_t ComTmrCalcTime | ( | uint32_t | ulTicksV | ) |
Calculate time based on timer ticks.
ulTicksV | - number of timer ticks |
The function calculates the time (in microseconds) based on the given number of timer ticks and the constant value COM_TIMER_PERIOD.
void ComTmrSetPeriod | ( | uint32_t | ulPeriodV | ) |
Configure timer period.
ulPeriodV | - number of timer ticks |
The function sets the timer period which is used to call the function ComMgrTimerEvent(). The parameter ulPeriodV is a multiple of 1 microsecond. The default value of the timer period is defined by the constant value COM_TIMER_PERIOD. This function can be used to overwrite the default value during run-time.