FB_EcExtSyncCalcTimeDiff64

FB_EcExtSyncCalcTimeDiff64 1:

The function block FB_EcExtSyncCalcTimeDiff64 calculates the difference between external and internal time, taking into account the time offsets.

FB_EcExtSyncCalcTimeDiff64 2: Inputs/outputs

VAR_IN_OUT
   DcToTcTimeOffset  : ULINT;
   DcToExtTimeOffset : ULINT;
   ExtTime           : T_DCTIME64;
   IntTime           : T_DCTIME64;
END_VAR

Name

Type

Description

DcToTcTimeOffset  

ULINT

Time offset between the TwinCAT "Distributed Clock" system time and the TwinCAT system time

DcToExtTimeOffset 

ULINT

Time offset between the TwinCAT "Distributed Clock" system time and an external time

ExtTime

T_DCTIME64

External time in TwinCAT "Distributed Clock" system time format

IntTime

T_DCTIME64

Internal time in TwinCAT "Distributed Clock" system time format

FB_EcExtSyncCalcTimeDiff64 3: Outputs

VAR_OUTPUT
   nTimeDiff             : UDINT; (*with difference greater than 32 bit timeDiff = 0xfffffff*)
   nOffsetFromSyncMaster : DINT; (*less than 32 bit int Offset = 0x80000000, greater than 32 bit int Offset = 0x7FFFFFFF*)
END_VAR

Name

Type

Description

nTimeDiff

UDINT

If the difference is less than 32 bits, the time difference is returned. If the difference is greater than 32 bits, 16#FFFFFFFF is returned.

nOffsetFrom
SyncMaster

DINT

If the difference is greater than 32 bits and the offset between internal and DC Time is less than 32 bits, then 16#80000000 is returned.
If the difference is greater than 32 bits and the offset between internal and DC Time is greater than 32 bits, then 16#7FFFFFFF is returned.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_EtherCAT