图片:
只需声明一个 TON实例即可,源程序如下,可原文拷贝测试
(*以M0替代X0*)
IF LDP(TRUE , M0) THEN
Z0 := 0;
END_IF;
IF LDF(TRUE , M0) THEN
ZRST( TRUE, Y0, Y7);
END_IF;
TON_1(IN:= M0 AND NOT TON_1.Q,PT:= T#1S);
IF TON_1.Q THEN
Y0Z0 := NOT Y0Z0;
Z0 := Z0+1;
IF Z0>=8 THEN
Z0 := 0;
END_IF;
END_IF;