Operator:
Description
+
Add
-
Subtract/negate
*
Multiply
/
Divide
=
Equal
<
Less than
<=
Less than or equal
>
Greater than
>=
Greater than or equal
<>
Not equal
**
Exponent (x to y)
ABS
Absolute value
ACS
Arc cosine
AND
Bitwise AND
ASN
Arc sine
ATN
Arc tangent
COS
Cosine
DEG
Radians to degrees
Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)
CMP Expressions
You program expressions in CMP instructions the same as expressions in FSC
instructions. Use the following sections for information on valid operators,
format, and order of operation, which are common to both instructions.
Valid Operators
Optimal
DINT,
EAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
DINT, REAL
REAL
DINT
REAL
REAL
REAL
DINT, REAL
Format Expressions
For each operator that you use in an expression, you have to provide one or two
operands (tags or immediate values). Use this table to format operators and
operands within an expression
Operators that
operate on
One operand
Two operands
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Operator:
Description
R
FRD
BCD to integer
LN
Natural log
LOG
Log base 10
MOD
Modulo-divide
NOT
Bitwise complement
OR
Bitwise OR
RAD
Degrees to radians
SIN
Sine
SQR
Square root
TAN
Tangent
TOD
Integer to BCD
TRN
Truncate
XOR
Bitwise exclusive OR
.
Use this format
Operator (operand)
Operand_a operator operand_b
Chapter 5
Optimal
DINT
REAL
REAL
DINT, REAL
DINT
DINT
DINT, REAL
REAL
DINT, REAL
REAL
DINT
DINT, REAL
DINT
Examples
ABS(tag_a)
·tag_b + 5
·tag_c AND tag_d
·(tag_e ** 2) MOD (tag_f /
tag_g)
223