F_CXSubTimeStamp

F_CXSubTimeStamp 1:

The function F_CXSubTimeStamp executes a 64bit-Subtraction time stamp A - time stamp B and converts the result to µs. The needed 64bit-time stamps with a resolution of 100ns can be read with the function block GETCPUCOUNTER from the system.

If the difference between time stamp A and time stamp B is negative or bigger than 4294967295us, then the maximum value 4294967295us is returned. This is 71 minutes, 34 seconds, 967 milli seconds and 295 micro seconds. In these cases the function UInt64Sub64() of the TcUtilities.lib can be used to calculate a 64-Bit subtraction with a 64-Bit result in [100ns].

FUNCTION F_CXSubTimeStamp : UDINT

VAR_INPUT
    nTimeStampLoDW_A : UDINT; (* 2*32 bit time stamp A: low DWORD  *)
    nTimeStampHiDW_A : UDINT; (* 2*32 bit time stamp A: high DWORD *)
    nTimeStampLoDW_B : UDINT; (* 2*32 bit time stamp B: low DWORD  *)
    nTimeStampHiDW_B : UDINT; (* 2*32 bit time stamp B: high DWORD *)
END_VAR

nTimeStampLoDW_A: Lower 32bit of time stamp A.

nTimeStampHiDW_A: Upper 32bit of time stamp A.

nTimeStampLoDW_B: Lower 32bit of time stamp B.

nTimeStampHiDW_B: Upper 32bit of time stamp B.