顺序启动,每按一次启动按钮启动一台电机,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";
逆序停止,每按一次停止按钮停掉最后启动的那台电机,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";