PLC实现重复定时

PLC实现重复定时

PLC实现定时器复位其实是一个很简单的问题,无奈脑子太笨,想了一下午才搞定,写一个小的测试程序如下:

PROGRAM _CYCLIC
    (* Insert code here *)
    TON_0(IN := cmd,PT := T#3s);
    status := TON_0.Q ;
    IF status = 1
        THEN 
        cmd := 0;
        light := 0;
    ELSE
        light := 1;
    END_IF
END_PROGRAM

TON_0是一个TON功能块实例,使用方法如下:

I/O Parameter Data Type Description
IN IN BOOL Input signal
IN PT UDINT Delay time in 10 ms steps
OUT Q BOOL Output signal, the rising edge of the input signal is delayed by PT
OUT ET UDINT Elapsed time in 10 ms increments

原文地址:https://www.cnblogs.com/zhengkang/p/5712443.html