CANopen Master Documentation
Version 6.06.04
Loading...
Searching...
No Matches
com_tmr.h File Reference

Detailed Description

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.

+ Include dependency graph for com_tmr.h:

Functions

uint32_t ComTmrCalcTicks (uint32_t ulReqTimingV)
 
uint32_t ComTmrCalcTime (uint32_t ulTicksV)
 
void ComTmrSetPeriod (uint32_t ulPeriodV)
 

Function Documentation

◆ ComTmrCalcTicks()

uint32_t ComTmrCalcTicks ( uint32_t  ulReqTimingV)

Calculate number of timer ticks.

Parameters
ulReqTimingV- requested time in microseconds
Returns
number of required timer ticks
See also
ComTmrCalcTime()

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.

◆ ComTmrCalcTime()

uint32_t ComTmrCalcTime ( uint32_t  ulTicksV)

Calculate time based on timer ticks.

Parameters
ulTicksV- number of timer ticks
Returns
time in microseconds
See also
ComTmrCalcTicks()

The function calculates the time (in microseconds) based on the given number of timer ticks and the constant value COM_TIMER_PERIOD.

◆ ComTmrSetPeriod()

void ComTmrSetPeriod ( uint32_t  ulPeriodV)

Configure timer period.

Parameters
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.