GETCPUCOUNTER
The CPU cycle counter can be read with this function block. The numerical value is a relative 64 bit integer, which, independently of the CPUs internal clock rate, is output in a form converted into 100 ns ticks. The number is refreshed to a precision of 100 ns 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.
Inputs
VAR_INPUT
(*none*)
END_VAR
Outputs
VAR_OUTPUT
cpuCntLoDW : UDINT;
cpuCntHiDW : UDINT;
END_VAR
Name | Type | Description |
---|---|---|
cpuCntLoDW | UDINT | Least significant 4 bytes of the count value |
cpuCntHiDW | UDINT | Most significant 4 bytes of the count value |
Requirements
Development environment |
Target system type |
PLC libraries to include (Category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_System (System) |