FB_EcExtSyncCalcTimeDiff

FB_EcExtSyncCalcTimeDiff 1:
FB_EcExtSyncCalcTimeDiff 2:

Outdated function block

This function block is outdated. Use the function block FB_EcExtSyncCalcTimeDiff64 instead.

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

FB_EcExtSyncCalcTimeDiff 3: Inputs/outputs

VAR_IN_OUT
   DcToTcTimeOffset  : T_LARGE_INTEGER;
   DcToExtTimeOffset : T_LARGE_INTEGER;
   ExtTime           : T_DCTIME;
   IntTime           : T_DCTIME;
END_VAR

Name

Type

Description

DcToTcTime
Offset  

T_LARGE_
INTEGER

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

DcToExtTime
Offset 

T_LARGE_
INTEGER

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

ExtTime

T_DCTIME

External time in TwinCAT "Distributed Clock" system time format

IntTime

T_DCTIME

Internal time in TwinCAT "Distributed Clock" system time format

FB_EcExtSyncCalcTimeDiff 4: 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