Comparisons Within Logic Operations - Mitsubishi Electric FX2N Beginners Manual

Hide thumbs Also See for FX2N:
Table of Contents

Advertisement

Compare Instructions
5.3.2

Comparisons within logic operations

In the CMP instruction described in the last section the result of the comparison is stored in
three bit devices. Often, however, you only want to execute an output instruction or a logic oper-
ation on the basis of the result of a comparison, and you generally won't want to have to use
three bit devices for this. You can achieve this with the "load compare" instructions and the AND
and OR bitwise logic comparisons.
Comparison at the beginning of a logic operation
Ladder Diagram
0
³ Compare condition
· First compare value
» Second compare value
If the condition evaluates true the signal state after the comparison is set to "1". A signal state of
"0" shows that the comparison evaluated as false. The following comparisons are possible:
Compare for "equals":
The output of the instruction is only set to "1" if the values of both devices are identical.
Compare for "greater than":
The output of the instruction is only set to "1" if the first value is greater than the second value.
Compare for "less than":
The output of the instruction is only set to "1" if the first value is smaller than the second value.
Compare for "not equal":
The output of the instruction is only set to "1" if the two values are not equal.
Compare for "less than or equal to":
The output of the instruction is only set to "1" if the first value is less than or equal to the se-
cond value.
Compare for "greater than or equal to": >=
The output of the instruction is only set to "1" if the first value is greater than or equal to the
second value.
To compare 32-bit data prefix a D (for double word) to the compare condition:
Ladder Diagram
0
5 – 18
>= D40 D50
D> D10 D250
This "D" specifies 32-bit data
Instruction List
0 LD>=
=
(value 1 = value 2)
>
(value 1 > value 2)
<
(value 1 < value 2)
<>
(value 1 <> value 2)
<=
(value 1
(value 1
Instruction List
0 LDD>
More Advanced Programming
D40
D50
value 2)
value 2)
D10
D250
MITSUBISHI ELECTRIC

Advertisement

Table of Contents
loading

Table of Contents