Allen-Bradley LOGIX 5000 Reference Manual page 508

Controllers advanced process control and drives and equipment phase and sequence instructions
Hide thumbs Also See for LOGIX 5000:
Table of Contents

Advertisement

Chapter 10
Structured Text Programming
Structured Text Syntax
508
Structured text is a textual programming language that uses statements to define
what to execute.
Structured text is not case sensitive.
Use tabs and carriage returns (separate lines) to make your structured text
easier to read. They have no effect on the execution of the structured text.
Structured text is not case sensitive. Structured text can contain these
components.
Term
Definition
Assignment
Use an assignment statement to assign values to tags. The := operator
is the assignment operator.
Terminate the assignment with a semi colon ';.'
Expression
An expression is part of a complete assignment or construct
statement. An expression evaluates to a number (numerical
expression), a String (string expression), or to a true or false state
(BOOL expression)
Tag Expression
A named area of the memory where data is stored (BOOL, SINT, INT,
DINT, REAL, String).
Immediate
A constant value
Expression
Operators
A symbol or mnemonic that specifies an operation within an
Expression
expression.
Function Expression When executed, a function yields one value. Use parentheses to
contain the operand of a function.
Even though their syntax is similar, functions differ from instructions
in that functions can be used only in expressions. Instructions cannot
be used in expressions.
Instruction
An instruction is a standalone statement.
An instruction uses parentheses 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(;).
Even though their syntax is similar, instructions differ from functions
in that instructions cannot be used in expressions. Functions can be
used only in expressions.
Construct
A conditional statement used to trigger structured text code (that is,
other statements). Terminate the construct with a semi colon (;).
Comment
Text that explains or clarifies what a section of structured text does.
Use comments to make it easier to interpret the structured text.
Comments do not affect the execution of the structured text.
Comments can appear anywhere in structured text.
Rockwell Automation Publication 1756-RM006K-EN-P - November 2018
Examples
tag := expression;
value1
4
tag1 + tag2
tag1 >= value1
function(tag1)
instruction();
instruction(operand);
instruction(operand1,
operand2,operand3);
IF...THEN CASE FOR...DO
WHILE...DO
REPEAT...UNTIL
EXIT
//comment
(*start of comment . . . end
of comment*)
/*start of comment . . . end
of comment*/

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents