EasyManuals Logo
Home>Allen-Bradley>Controller>Logix5000

Allen-Bradley Logix5000 Reference Manual

Allen-Bradley Logix5000
708 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #673 background imageLoading...
Page #673 background image
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 673
Structured Text Programming Appendix C
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 Determine the
Order of Execution on page 678.
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 Then
Calculate an arithmetic value Use Arithmetic Operators and Functions
on page 674.
Compare two values or strings Use Relational Operators
on page 675.
Check if conditions are true or false Use Logical Operators
on page 677.
Compare the bits within values Use Bitwise Operators
on page 678.

Table of Contents

Other manuals for Allen-Bradley Logix5000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Logix5000 and is the answer not in the manual?

Allen-Bradley Logix5000 Specifications

General IconGeneral
BrandAllen-Bradley
ModelLogix5000
CategoryController
LanguageEnglish

Related product manuals