Structured Text Programming
514 Rockwell Automation Publication 1756-RM006K-EN-P - November 2018
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.
• Nest a numeric expression within a BOOL expression. For example,
(tag1+5)>65.
String expression: An expression that represents a string
• A simple expression can be a string literal or a string tag
Use this table to select the operators for expressions.
If Use
Calculating an arithmetic value Arithmetic operators and functions
Comparing two values or strings Relational operators
Verifying if conditions are true or false Logical operators
Comparing the bits within values Bitwise operators
See also
Use arithmetic operators and functions on page 514
Use relational operators on page 517
Use logical operators on page 516
Use bitwise operators on page 516
Combine multiple operators and functions in arithmetic expressions.
Operators calculate new values.
To Use this operator Optimal data type
Add + DINT, REAL
Subtract/negate - DINT, REAL
Multiply * DINT, REAL
Exponent (x to the power of y) ** DINT, REAL
Divide / DINT, REAL
Modulo-divide MOD DINT, REAL
Functions perform math operations. Specify a constant, a non-Boolean tag, or an
expression for the function.
Use arithmetic operators and
functions