GETCPUCOUNTER

GETCPUCOUNTER 1:
The CPU cycle counter can be read with this function block. The numerical value is a relative 64 bit integer, which, independently of the CPU’s internal clock rate, is output in a form converted into 100ns ticks. The number is refreshed to a precision of 100ns with every call by the PLC system, and can be used, for instance, for timing tasks. 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
    cpuCntLoDW      : UDINT;
    cpuCntHiDW      : UDINT;
END_VAR

cpuCntLoDW : Contains the low-value 4 bytes of the numerical value.

cpuCntHiDW : Contains the high-value 4 bytes of the numerical value.

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