Compare (Cmp); Relay Ladder; Structured Text - 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

Compare (CMP)

Description:
Arithmetic Status Flags:
Fault Conditions:
The CMP instruction performs a comparison on the arithmetic operations you
specify in the expression.
Operands:

Relay Ladder

Operand
Expression

Structured Text

Structured text does not have a CMP instruction, but you can achieve the same
results by using an IF...THEN construct and expression.
IF BOOL_expression THEN
<statement>;
END_IF;
See
Structured Text Programming
and expressions within structured text.
Define the CMP expression by using operators, tags, and immediate values. Use
parentheses ( ) to define sections of more complex expressions.
The execution of a CMP instruction is slightly slower and uses more memory
than the execution of the other comparison instructions. The advantage of the
CMP instruction is that it allows you to enter complex expressions in
one instruction.
The CMP instruction affects only the arithmetic status flags if the expression
contains an operator (for example, +, −, *, /) that affects the arithmetic
status flags.
None
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Compare Instructions (CMP, EQU, GEQ, GRT, LEQ, LES, LIM, MEQ, NEQ)
Type
Format
SINT
Immediate Tag
INT
DINT
REAL
string
A SINT or INT tag converts to a DINT value by sign-extension.
for information on the syntax of constructs
Description
An expression consisting of tags and/or
immediate values separated by operators.
Chapter 5
221

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents