J1939 Documentation
Version 4.16.00
|
The timer values for J1939 services are set in a multiple of 1 millisecond. 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 J1939_TIMER_PERIOD inside the j1939_conf.h file.
The requested time values are converted into timer ticks and vice versa with the functions J1939_TmrCalcTicks() and J1939_TmrCalcTime() respectively.
Functions | |
uint16_t | J1939_TmrCalcTicks (uint16_t uwReqTimingV) |
uint16_t | J1939_TmrCalcTime (uint16_t uwTicksV) |
void | J1939_TmrEvent (void) |
uint16_t J1939_TmrCalcTicks | ( | uint16_t | uwReqTimingV | ) |
Calculate number of timer ticks.
uwReqTimingV | - requested time in milliseconds |
The function calculates the number of required timer ticks (i.e. timer interrupts) based on the required time 'uwReqTimingV' (in milliseconds) and the constant value J1939_TIMER_PERIOD.
uint16_t J1939_TmrCalcTime | ( | uint16_t | uwTicksV | ) |
Calculate time based on timer ticks.
uwTicksV | - number of timer ticks |
The function calculates the time (in milliseconds) based on the given number of timer ticks and the constant value J1939_TIMER_PERIOD.
void J1939_TmrEvent | ( | void | ) |
Execute Timer-based Services.
This routine must be called by a timer resource of the target system. It is responsible to call services that depend on a timer (e.g. BAM). The period of the timer is defined via the J1939_TIMER_PERIOD constant.
Example