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

Detailed Description

The TIME stamp Object is broadcasted periodically by the TIME producer. This TIME provides the simple network clock.

There may be a time jitter in transmission by the TIME producer corresponding approximately to the latency due to some other message being transmitted just before the TIME. In order to guarantee timely access to the CAN bus the TIME is given a very high priority identifier (see object 1012h).

+ Include dependency graph for com_time.h:

Data Structures

struct  ComTimeOfDay_s
 

Enumerations

enum  ComTimeMode_e {
  eCOM_TIME_MODE_CONSUMER = 0 ,
  eCOM_TIME_MODE_PRODUCER = 1 ,
  eCOM_TIME_MODE_DISABLE = 2
}
 

Functions

void ComTimeEventConsume (uint8_t ubNetV, ComTimeOfDay_ts *ptsTimeStampV)
 
ComStatus_tv ComTimeGetId (uint8_t ubNetV, uint32_t *pulIdV)
 
ComStatus_tv ComTimeGetMode (uint8_t ubNetV, uint8_t *pubModeV)
 
ComStatus_tv ComTimeProduce (uint8_t ubNetV)
 
ComStatus_tv ComTimeSetId (uint8_t ubNetV, uint32_t ulIdV)
 
ComStatus_tv ComTimeSetMode (uint8_t ubNetV, uint8_t ubModeV)
 
ComTimeOfDay_tsComTimeStampFromLocaltime (void)
 

Enumeration Type Documentation

◆ ComTimeMode_e

The enumeration defines the values for setting the TIME service mode to either producer or consumer. The definitions are used by ComTimeGetMode() and ComTimeSetMode().

By default (i.e. after start-up of the protocol stack), the TIME service is disabled.

Enumerator
eCOM_TIME_MODE_CONSUMER 

Consume TIME service

eCOM_TIME_MODE_PRODUCER 

Produce TIME service

eCOM_TIME_MODE_DISABLE 

Disable TIME service

Function Documentation

◆ ComTimeEventConsume()

void ComTimeEventConsume ( uint8_t  ubNetV,
ComTimeOfDay_ts ptsTimeStampV 
)
Parameters
[in]ubNetVCANopen Network channel
[out]ptsTimeStampVPointer to time-of-day structure

This function is called upon reception of a TIME message.

The action on this function is application specific. The function body is placed inside the file com_user.c.

◆ ComTimeGetId()

ComStatus_tv ComTimeGetId ( uint8_t  ubNetV,
uint32_t *  pulIdV 
)
Parameters
[in]ubNetVCANopen Network channel
[out]pulIdVPointer to identifier value variable
Returns
Value of enumeration ComErr_e
See also
ComTimeSetId()

This function reads the identifier value for the TIME service.

◆ ComTimeGetMode()

ComStatus_tv ComTimeGetMode ( uint8_t  ubNetV,
uint8_t *  pubModeV 
)
Parameters
[in]ubNetVCANopen Network channel
[out]pubModeVPointer to device mode variable
Returns
Value of enumeration ComErr_e

This function reads the device mode for the TIME service.

◆ ComTimeProduce()

ComStatus_tv ComTimeProduce ( uint8_t  ubNetV)
Parameters
[in]ubNetVCANopen Network channel
Returns
Value of enumeration ComErr_e
See also
ComTimeGetTimeOfDay()

This function is used by the application in order to trigger the transmission of the TIME service. The internal TIME_OF_DAY structure is copied into the service payload.

◆ ComTimeSetId()

ComStatus_tv ComTimeSetId ( uint8_t  ubNetV,
uint32_t  ulIdV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ulIdVIdentifier value
Returns
Value of enumeration ComErr_e
See also
ComTimeSetMode()

This function changes the identifier value for the TIME service. If the ID_FLAG_EXTENDED is set, the CANopen service uses the Extended Frame Format (EFF, 29-Bit CAN-ID).

◆ ComTimeSetMode()

ComStatus_tv ComTimeSetMode ( uint8_t  ubNetV,
uint8_t  ubModeV 
)
Parameters
[in]ubNetVCANopen Network channel
[in]ubModeVService mode
Returns
Value of enumeration ComErr_e

This function changes the mode (producer/consumer) for the TIME service, possible values for the parameter ubModeV are defined by the enumeration ComTimeMode_e.

@ eCOM_NET_1
Definition com_defs.h:723
ComStatus_tv ComTimeSetMode(uint8_t ubNetV, uint8_t ubModeV)
@ eCOM_TIME_MODE_PRODUCER
Definition com_time.h:79
ComTimeOfDay_ts * ComTimeStampFromLocaltime(void)
ComStatus_tv ComTimeProduce(uint8_t ubNetV)
ComStatus_tv ComTimeSetId(uint8_t ubNetV, uint32_t ulIdV)

◆ ComTimeStampFromLocaltime()

ComTimeOfDay_ts * ComTimeStampFromLocaltime ( void  )
Returns
Pointer to time-of-day structure

The implementation is OS specific.