5-4
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
Compare Word Integer
The Compare Word Integer instruction is used to compare two
values: n1 = n2, n1 >= n2, or n1 <= n2.
Operands:
n1:
T, C, MW, SMW
n2:
T, C, MW, SMW, Constant
In ladder, the contact is on when the comparison is true.
In STL, the instructions Load, AND, or OR a 1 with the top of
stack when the comparison is true.
Word comparisons are signed (16#7FFF > 16#8000).
You can create a <>, <, or > comparison by using the Not
instruction with the =, >=, or <= compare instruction. The
following sequence is equivalent to a <> comparison of MW0 to
50:
LDW=
MW0, 50
NOT
Contact Examples
NETWORK 1
LD
I0.0
A
I0.1
=
Q0.0
NETWORK 2
LD
I0.0
NOT
=
Q0.1
NETWORK 3
LD
I0.1
ED
=
Q0.2
NETWORK 4
LDW>=
MW0, MW2
=
Q0.3
Network 1
Q0.0
LAD
STL
I0.0
I0.1
Network 2
Q0.1
I0.0
NOT
Network 3
Q0.2
I0.1
N
Network 4
Q0.3
MW0
MW2
>=I
Timing Diagram
I0.0
I0.1
Q0.0
Q0.1
Q0.2
Q0.3
MW0 >= MW2
MW0 < MW2
On for one scan
Figure 5-1
Example of Boolean Contact Instructions
Instruction Set
L
A
D
S
T
L
LDW=
n1, n2
AW=
n1, n2
OW=
n1, n2
LDW>= n1, n2
AW>=
n1, n2
OW>=
n1, n2
LDW<= n1, n2
AW<=
n1, n2
OW<=
n1, n2
n1
==I
n2
n1
>=I
n2
n1
<=I
n2
Summary of Contents for Simatic S7-200 CPU 210
Page 10: ...x S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Contents ...
Page 116: ...A 16 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Data Sheets ...
Page 126: ...F 2 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 CPU 210 Order Numbers ...
Page 138: ...Index 12 S7 200 Programmable Controller CPU 210 C79000 G7076 C235 01 Index ...