DINT
环形计数器分辨率
PLC从属10,24ms或10,67ms类型环形计数器的分辨率,以纳秒为单位。
使用条件编译确保为每个PLC类型计算精确时间值:
#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;