
Chapter 5. Application instructions
5-21
5.3.3
LD ( =, >, <, >=, <=, <> )
LD
(Start NO contact
with comparison
result)
FUN(28) LD=
FUN(29) LDD=
FUN(38) LD>
FUN(39) LDD>
FUN(48) LD<
FUN(49) LDD<
FUN(58) LD>=
FUN(59) LDD>=
FUN(68) LD<=
FUN(69) LDD<=
FUN(78) LD<>
FUN(79) LDD<>
Applicable
CPU
K200S
K300S
K1000S
Available Device
Flag
Instructions
M
P
K
L
F
T
C
S
D
#D Integer
Steps
Error
(F110)
Zero
(F111)
Carry
(F112)
O O O O O O O
O
O
O
LD
LDD
O O O O O
O
O
O
O
O
5 / 9
O
1) Functions
-
Compares contents of [ S1 ] and [ S2 ], then operates as NO contact according to the comparison
operation result. The comparison is executed as signed operation.
-
The comparison operation result is as shown below :
Instruction
symbol in
Condition
Comparison
operation
result
Instruction
symbol in
Condition
Comparison
operation
result
=
S
1
=
S
2
=
S
1
≠
S
2
<=
S
1
≤
S
2
<=
S
1
>
S
2
>=
S
1
≥
S
2
>=
S
1
<
S
2
< >
S
1
≠
S
2
< >
S
1
=
S
2
<
S
1
<
S
2
<
S
1
≥
S
2
>
S
1
>
S
2
On
>
S
1
≤
S
2
Off
2) Program example
a) Compare P0000 ~ P000F and D0001. If their values are equal, P0010 bit will be switched on.
b) Compare 1000 and contents of D0001 and D0002 (32 bits). If the contents of D0001 and D0002 is
less than 1000, P0010 will turn on.
Operand setting
S1
S2
S1
S2
S1
S2
D
Data to be compared
S1
S2
= P000 D0001
(
P0010
)
D>= 1000 D0001
(
P0010
)