//启动程序
"R_TRIG_DB"(CLK:=#启动按钮);
IF"R_TRIG_DB".Q THEN
"当前步" := 1;
END_IF;
IF #停止按钮 THEN
"当前步" := 0;
#YV1 := 0;
#YV2 := 0;
#YV3 := 0;
#YV4 := 0;
#搅拌电机 := 0;
"当前步" := 0;
"计时" := 0;
END_IF;
"IEC_Timer_0_DB".TON(IN:="计时",
PT:=T#3S);
"IEC_Timer_0_DB_1".TON(IN:="当前步"=5,
PT:=T#3S);
CASE "当前步" OF
1: //液体到达SQ4时等待3秒后关闭YV4
#YV4 := 1;
IF NOT #SQ4 THEN
"计时" := 1;
;
END_IF;
IF "IEC_Timer_0_DB".Q AND NOT #SQ4 THEN
#YV4 := 0;
"当前步" := 2;
;
END_IF;
2: //开启YV1当达到SQ3时关闭YV1
#YV1 := 1;
IF #SQ3 THEN
#YV1 := 0;
"当前步":=3
;
END_IF;
3:
//开启YV2当达到SQ2时关闭YV2
#YV2 := 1;
IF #SQ2 THEN
#YV2 := 0;
"当前步" := 4
;
END_IF;
4:
//开启YV3当达到SQ1时关闭YV3
#YV3 := 1;
IF #SQ3 THEN
#YV3 := 0;
"当前步" := 5
;
END_IF;
5:
//开启搅拌机3S后关闭
#搅拌电机 := 1;
IF "IEC_Timer_0_DB_1".Q THEN
#搅拌电机 := 0;
"当前步" := 1
;
END_IF;
ELSE // Statement section ELSE
;
END_CASE;
楼主最近还看过