Measuring processing time in the PLC program
This sample shows you how to determine the processing time of a program code with the help of a small PLC program. This allows you to measure, for example, how long the PLC needs for a mathematical function, a loop or a specific program part. The resolution is 1 ns per digit.
Sample
VAR
MeasureStart : T_DCTIME64;
MeasureResult : T_DCTIME64;
END_VAR
PROGRAM:
MeasureStart:=F_GetActualDcTime64(); (*Insert your program code to measure the processing time*)
MeasureResult:=F_GetActualDcTime64()-MeasureStart;
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.0 | PC or CX (x86, x64, ARM) | Tc2_EtherCAT |