Structured Text Programming 
 
  Rockwell Automation Publication 1756-RM006K-EN-P - November 2018  529 
Affects Math Status Flags 
No 
Major/Minor Faults 
None. 
Examples 
Example 1 
IF…THEN 
If performing this  Enter this structured text 
IF rejects > 3 then  IF rejects > 3 THEN 
conveyor = off (0)  conveyor := 0; 
alarm = on (1)  alarm := 1; 
END_IF; 
Example 2 
IF_THEN_ELSE 
If performiing this  Enter this structured text 
If conveyor direction contact = forward (1) then  IF conveyor_direction THEN 
light = off  light := 0; 
Otherwise light = on  ELSE 
light [:=] 1; 
END_IF; 
The [:=] tells the controller to clear light 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.)