FB_EcExtSyncExtTimes

FB_EcExtSyncExtTimes 1:

The function block FB_EcExtSyncExtTimes enables or disables the synchronization of the internal and external clocks. The function block FB_EcExtSyncIsSynchronized can be used to check synchronization.

This function block is required for the synchronization.

The function block should be called at most every 2-5 ms. A new/fresh timestamp pair should be assigned to the function block every time it is called, otherwise the call is meaningless. The frequency of the function block call influences the quality of the time control. The more often the function block is called, the better the readjusted system can work. If the timestamp quality is good, one call per second, e.g. through a PPS signal (PulsePerSecond), may be sufficient.

FB_EcExtSyncExtTimes 2: Inputs

VAR_INPUT
    sNetId   : T_AmsNetId;
    bEnable  : BOOL;
    nExtTime : T_DCTIME64;
    nIntTime : T_DCTIME64;
END_VAR

Name

Type

Description

sNetId

T_AMSNetId

String containing the AMS network ID of the EtherCAT master device.

bEnable

BOOL

bEnable = TRUE enables the synchronization. bEnable = FALSE disables the synchronization.

nExtTime

T_DCTIME64

External timestamp

nIntTime

T_DCTIME64

Internal timestamp

FB_EcExtSyncExtTimes 3: Outputs

VAR_OUTPUT
    bTS1Done      : BOOL;
    bError        : BOOL;
    nErrorId      : UDINT;
    stFirstSendTS : ST_ExtTimingTimes;
END_VAR

Name

Type

Description

bTS1Done

BOOL

This output is set when the synchronization is enabled for the first time and the internal and external timestamps are written to the EtherCAT master.

bError

BOOL

This output is set if an error occurs during command execution.

nErrorId

UDINT

This output returns the error code, if the bError output is set.

stFirstSendTS

ST_ExtTimingTimes

This output is set to the internal and external timestamps that are written to the EtherCAT master.

Requirements

Development environment

Target platform

PLC library to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, Arm®)

Tc3_EtherCATExtSync