INT
Ring counter 10.24ms or 10.67ms if counting does not require an exact value.
The data register acts as a ring counter. The register value is increased by one every 10.24ms or 10.67ms (counting range: 0–32767 and -32768–0). Compare the register values (v) at two different times (v1 and v2) to determine the elapsed time (t): t = (v2-v1) x 10.24ms or 10.67ms.
The register value is updated at the beginning of each scan. It is also updated during read access using F0_MV, allowing the data register to be used to measure the execution time of program blocks.
#if (IsSystemVariableSupported('sys_iRingCounter_10usXX')) #then
if (NOT bIsInitialized) then
bIsInitialized:=TRUE;
iRingCounter_Old:=sys_iRingCounter_10usXX;
else
iRingCounter_New:=sys_iRingCounter_10usXX;
iRingCounterDiff:=iRingCounter_New-iRingCounter_Old;
diScanTime_ns:=INT_TO_DINT(iRingCounterDiff)*SYS_RINGCOUNTER_10us_RESOLUTION_ns;
iRingCounter_Old:=iRingCounter_New;
end_if;
#end_if;