sys_iRingCounter_100us

PLC状态信息

数据类型

INT

名称

环形计数器100ms

数据寄存器充当环形计数器。寄存器值每100ms增加一(计数范围:0–32767-32768–0)。 比较两个不同时间(v1v2)的寄存器值(v)以确定经过时间(t): t = (v2-v1) x 100ms.

实例
if (NOT bIsInitialized) then
    bIsInitialized:=TRUE;
    iRingCounter_Old:=sys_iRingCounter_100us;
    iScans:=1;
else
    iRingCounter_New:=sys_iRingCounter_100us;
    iRingCounterDiff:=iRingCounter_New-iRingCounter_Old;        
    if (iRingCounterDiff>0) then (* Important to work also for shorter scan times *)
        diScanTime_µs:=(INT_TO_DINT(iRingCounterDiff)*10000)/INT_TO_DINT(iScans);
        iRingCounter_Old:=iRingCounter_New;
        iScans:=1;
    else
        iScans:=iScans+1; 
    end_if;
end_if;

最后更新日期: 2020-02-20此页面上的反馈松下热线