Structured Text Programming
530 Rockwell Automation Publication 1756-RM006K-EN-P - November 2018
Example 3
IF…THEN…ELSIF
If performing this Enter this structured text
If sugar low limit switch = low (on) and sugar high limit switch = not high
(on) then
IF Sugar.Low & Sugar.High THEN
inlet valve = open (on) Sugar.Inlet [:=] 1;
Until sugar high limit switch = high (off ) ELSIF NOT(Sugar.High) THEN
Sugar.Inlet := 0;
END_IF;
The [:=] tells the controller to clear Sugar.Inlet whenever the controller does the
following :
Enters the RUN mode.
Leaves the step of an SFC if you configure the SFC for Automatic reset. (This
applies only if you embed the assignment in the action of the step or use the action
to call a structured text routine via a JSR instruction.)
Example 4
IF…THEN…ELSIF…ELSE
If performing this Enter this structured text
If tank temperature > 100 IF tank.temp > 200 THEN
then pump = slow pump.fast :=1; pump.slow :=0; pump.off :=0;
If tank temperature > 200 ELSIF tank.temp > 100 THEN
then pump = fast pump.fast :=0; pump.slow :=1; pump.off :=0;
Otherwise pump = off ELSE
pump.fast :=0; pump.slow :=0; pump.off :=1;
END_IF;
Use the REPEAT_UNTIL loop to continue performing an action until
conditions are true.
Operands
REPEAT
<statement>;