
Define a structured text routine Chapter 11
Rockwell Automation Publication 1756-RM084S-EN-P - March 2015 209
L5K structured text ST_ROUTINE example
This is an example of an exported structured text routine.
ST_ROUTINE <routine_name>
(*----------- Sample of ST code-----------------------------*)
‘IF (myInteger = 12) THEN
‘ myInteger := ((5 * myInputInteger1) + (7 *
myInteger2)) - 71;
‘ WHILE (myTmpVar >= 0) DO
‘ myInteger := myInteger + 3;
‘ myTmpVar := myTmpVar - 1;
‘ END_WHILE;
‘END_IF;
ND_ST_ROUTINE
These tables list each structured text instruction and function. For more details,
see these reference manuals.
Instruction Type Resource
Basic, sequential instruction
Logix5000 Controllers General Instructions Set Reference Manual, publication 1756-RM003.
Process control or drives
instruction
Logix5000 Controllers Advanced Process Control and Drives Instruction Set Reference Manual, publication1756-RM006.
Motion instruction Logix5000 Controllers Motion Instructions Reference Manual, publication MOTION-RM002.
Structured Text Instructions
Instruction Neutral Text Format
ABL
ABL(Channel,SerialPortControl);
ABS
dest := ABS(source);
ACB
ACB(Channel,SerialPortControl);
ACL
ACL(Channel,ClearSerialPortRead,ClearSerialPortWrite);
ACOS
dest := ACOS(source);
ADD
dest := sourceA + sourceB;
AHL
AHL(Channel,ANDMask,ORMask,SerialPortControl);
ALM
ALM(ALM_tag);
ALMA
ALMA (ALMA_tag,In,ProgAckAll,ProgramDisable,ProgEnable);
ALMD
ALMD (ALMD_tag,In,ProgAck,ProgReset,ProgDisable,ProgEnable);
AND
dest := sourceA & sourceB;
dest := sourceA AND sourceB;
ARD
ARD(Channel,Destination,SerialPortControl);
ARL
ARL(Channel,Destination,SerialPortControl);
ASIN
dest := ASIN(source);
ATAN
dest := ATAN(source);
Structured text