手写的一个定时器 可以通用其他plc
SettingTimeold :=SettingTime*1000.0;
IF Enable THEN
IF NOT DelayedComplete AND CurrentTime<=SettingTimeold THEN
CurrentTime:=CurrentTime+100.0; (*利用扫描周期计算时间,扫描周期100ms*)
IF CurrentTime>=SettingTimeold THEN
CurrentTime:=0.0;
DelayedComplete:=TRUE;
END_IF;
END_IF;
ELSE
DelayedComplete:=FALSE;
CurrentTime:=0.0;
END_IF;
EnableOld :=Enable ;