GETSYSTEMTIME

GETSYSTEMTIME 1:

With this block the operating system time stamp can be read. The time stamp is a 64 bit integer value, with a precision of 100ns, which is updated with every call of the PLC. Amongst other uses, it can be utilised for timing tasks or time measurements. One unit is equivalent to 100 ns. The reason for which this service is implemented as a block and not as a function is simply in the fact that two values must be returned, which, by definition, cannot be done by a function.

VAR_INPUT

(*none*)

VAR_OUTPUT

VAR_OUTPUT
    timeLoDW        : UDINT;
    timeHiDW        : UDINT;
END_VAR

timeLoDW : Contains the low-value 4 bytes of the time stamp.

timeHiDW : Contains the high-value 4 bytes of the time stamp.

 

Example of calling the block in FBD:

GETSYSTEMTIME 2:
The example illustrates calling the block via the instance ‘GetSystemTime1’, and delivers the 64 bit, integer value (hex) 1BCD6EAB05C4E60 as the time stamp.

Requirements

Development environment

Target system type

PLC libraries to include

TwinCAT v2.7.0

PC or CX (x86)

PLCSystem.Lib

TwinCAT v2.8.0

PC or CX (x86)

TcSystem.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

TcSystem.Lib