Assignments - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Appendix C
Structured Text Programming
Term
Definition
Instruction
An instruction is a standalone statement.
(see
page
679)
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(;).
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).
(see
page
680)
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
(see
page
696)
text.
·Comments do not affect the execution of the structured text.
·Comments can appear anywhere in structured text.

Assignments

670
Use an assignment to change the value stored within a tag. An assignment has this
syntax:
tag := expression ;
where:
Component
Tag
:=
Expression
;
The tag retains the assigned value until another assignment changes the value.
The expression can be simple, such as an immediate value or another tag name, or
the expression can be complex and include several operators and/or functions.
See
Expressions
on
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Examples
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*/
Description
Represents the tag that is getting the new value
The tag must be a BOOL, SINT, INT, DINT, or REAL
Is the assignment symbol
Represents the new value to assign to the tag
If tag is this data type
BOOL
SINT
INT
DINT
REAL
Ends the assignment
page
673.
Use this type of expression
BOOL expression
Numeric expression

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents