順序啟動,每按一次啟動按鈕啟動一臺電機(jī),I0.0為啟動按鈕,Q0.0----Q0.
IF "I0.0" AND "M0.0" = 0 THEN
"Q0.4" := "Q0.3";
"Q0.3" := "Q0.2";
"Q0.2" := "Q0.1";
"Q0.1" := "Q0.0";
"Q0.0" := 1;
END_IF;
"M0.0" := "I0.0";
逆序停止,每按一次停止按鈕停掉最后啟動的那臺電機(jī),I0.1為停止按鈕,Q0.4----Q0.0
IF "M0.1" AND NOT "I0.1" THEN
"Q0.0" := "Q0.1";
"Q0.1" := "Q0.2";
"Q0.2" := "Q0.3";
"Q0.3" := "Q0.4";
"Q0.4" := 0;
END_IF;
"M0.1" := "I0.1";