M120.5 :=M100.5 AND NOT M110.5;//m100.5設置的時鐘周期一秒 產生一秒脈沖
M110.5 :=M100.5;
M22.0 :=I0.0 AND (NOT M22.1); // i0.0的上升沿
M22.1 :=I0.0;
IF M22.0 AND NOT Q0.0 THEN //沒啟動
MW0 :=1;
ELSE IF M22.0 AND Q0.2 THEN //全啟動
MW0 := 2;
ELSE IF M22.0 AND Q0.0 AND NOT Q0.2 THEN //未全啟動
MW0 :=3;
END_IF;
END_IF;
END_IF;
CASE MW0 OF
1:
IF M120.5 AND (NOT Q0.2)THEN
MW10 := MW10+1;
END_IF;
Q0.0 :=MW10>=5;
Q0.1 :=MW10>=10;
Q0.2 :=MW10>=15;
2:
IF M120.5 AND Q0.0 THEN
MW12 :=MW12 +1;
END_IF;
Q0.2 :=0;
IF MW12=3 THEN
Q0.1 :=0;
ELSE IF MW12=6 THEN
Q0.0 :=0;
END_IF;
END_IF;
3:
IF MW10 <10 THEN
Q0.0 :=0;
ELSE IF MW10>=10 AND M120.5 AND Q0.0 THEN
Q0.1 :=0;
MW14 :=MW14 +1 ;
ELSE IF MW14 =1 THEN
Q0.0 :=0;
END_IF;
END_IF;
END_IF;
END_CASE;
M22.3 := NOT Q0.0 AND M22.4;
M22.4 :=Q0.0;
IF M22.3 THEN
MW10 :=0;
MW12 :=0;
MW14 :=0;
END_IF;
END_ORGANIZATION_BLOCK