
Chapter 11 Define a structured text routine
206 Rockwell Automation Publication 1756-RM084S-EN-P - March 2015
ST_Routine attributes
Attribute Description
Name L5X only. Specify the name of the routine.
In L5K, the name is an element of the statement.
Type L5X only. Specify ST.
In L5K, the type of routine is part of the routine statement.
OnlineEditType
L5X only. Specify the online edit logic type. The options include Original,
PendingEdits, or TestEdits. This attribute is not specified if there are no edits.
In L5X, this attribute is on the <STContent> element.
Enter the structured text logic within a routine component in an import/export
file. Each line of structured text must begin with a single quote (‘).
Structured text is not case sensitive. Structured text can contain these elements.
Term Definition Examples
Assignment Use an assignment statement to assign values to tags.
The := operator is the assignment operator.
Terminate the assignment with a semi colon ";".
tag := expression;
Expression An expression is part of a complete assignment or construct statement. An expression evaluates
to a number (numerical expression) or to a true or false state (BOOL expression).
An expression contains these elements.
Tags A named area of the memory where data is stored (BOOL, SINT, INT,
DINT, REAL, string).
value1
Immediates A constant value.
4
Operators A symbol or mnemonic that specifies an operation within an
expression.
tag1 + tag2
tag1 >= value1
Functions When executed, a function yields one value. Use parentheses to
contain the operand of a function.
Functions can be used only in expressions.
function(tag1)
Instruction An instruction is a standalone statement.
An instruction uses parenthesis to contain its operands.
Depending on the instruction, there can be zero, one, or multiple operands.
When executed, an instruction yields one or more values that are part of a data structure.
Terminate the instruction with a semi colon ";".
Instructions cannot be used in expressions.
instruction();
instruction(operand);
instruction(operand1,
operand2,operand3);
Structured text logic