Expressions - 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

Expressions

An expression is a tag name, equation, or comparison. To write an expression, use
any of the following:
• Tag name that stores the value (variable)
• Number that you enter directly into the expression (immediate value)
• Functions, such as: ABS, TRUNC
• Operators, such as: +, -, <, >, And, Or
As you write expressions, follow these general rules:
• Use any combination of upper-case and lower-case letter. For example, these
three variations of 'AND' are acceptable: AND, And, and.
• For more complex requirements, use parentheses to group expressions within
expressions. This makes the whole expression easier to read and ensures
that the expression executes in the desired sequence. See
Order of Execution
In structured text, you use two types of expressions.
BOOL expression: An expression that produces either the BOOL value of
1 (true) or 0 (false).
• A bool expression uses bool tags, relational operators, and logical operators
to compare values or check if conditions are true or false. For example,
tag1>65.
• A simple bool expression can be a single BOOL tag.
• Typically, you use bool expressions to condition the execution of other logic.
Numeric expression: An expression that calculates an integer or floating-point
value.
• A numeric expression uses arithmetic operators, arithmetic functions, and
bitwise operators. For example, tag1+5.
• Often, you nest a numeric expression within a bool expression. For example,
(tag1+5)>65.
Use the table to choose operators for your expressions.
If you want to
Calculate an arithmetic value
Compare two values or strings
Check if conditions are true or false
Compare the bits within values
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Structured Text Programming
on
page
678.
Then
Use Arithmetic Operators and Functions
Use Relational Operators
on
page
Use Logical Operators
on
page
677.
Use Bitwise Operators
on
page
678.
Appendix C
Determine the
on
page
674.
675.
673

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents