Compare Word Integer; Contact Examples - Siemens Simatic S7-200 CPU 210 System Manual

Table of Contents

Advertisement

Instruction Set

Compare Word Integer

L
n1
A
==I
D
n2
n1
>=I
n2
n1
<=I
n2
S
LDW=
T
AW=
L
OW=
LDW>= n1, n2
AW>=
OW>=
LDW<= n1, n2
AW<=
OW<=

Contact Examples

Network 1
I0.0
Network 2
I0.0
Network 3
I0.1
Network 4
MW0
>=I
MW2
MW0 >= MW2
Figure 5-1
Example of Boolean Contact Instructions
5-4
The Compare Word Integer instruction is used to compare two
values: n1 = n2, n1 >= n2, or n1 <= n2.
Operands:
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
n1, n2
instruction with the =, >=, or <= compare instruction. The
n1, n2
following sequence is equivalent to a <> comparison of MW0 to
n1, n2
50:
n1, n2
LDW= MW0, 50
n1, n2
NOT
n1, n2
n1, n2
LAD
I0.1
Q0.0
Q0.1
NOT
Q0.2
N
Q0.3
Timing Diagram
I0.0
I0.1
Q0.0
Q0.1
Q0.2
Q0.3
n1:
T, C, MW, SMW
n2:
T, C, MW, SMW, Constant
STL
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
On for one scan
S7-200 Programmable Controller, CPU 210
C79000-G7076-C235-01
MW0 < MW2

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents