Cmp: compare @cmp: compare – KEYENCE Visual KV Series User Manual
Page 170

2.4 Instruction Details
3-146
2
Chapter 2 Instructions
CMP instruction compares the contents of the internal register with the value speci-
fied by the operand, and turns ON/OFF the special utility relays (2009, 2010, 2011)
according to the result of comparison.
Comparing the current value of the counter and CMP value
1) Output relay 0500 turns ON when the counter value is smaller than "1000" (C001
< #01000).
2) Output relay 0501 turns ON when the counter value is equal to "1000" (C001 =
#01000).
3) Output relay 0502 turns ON when the counter value is greater than "1000" (C001
> #01000).
4) Output relay 0503 turns ON when the counter value is equal to or greater than
"2000" (C001 ≥ #02000).
Coding
CMP: Compare
@CMP: Compare
Compares contents of internal register with
value specified by operand.
@
#,$
FUN
FUN
LDB
4
RES
0
LDB
4
RES
0
nnnn
CMP
nnnn
CMP
2009
2010
2011
(Internal register) < (Operand)
ON
OFF
OFF
(Internal register) = (Operand)
OFF
ON
OFF
(Internal register) > (Operand)
OFF
OFF
ON
0001
C001
LDA
#01000
CMP
0500
#09999
0003
C001
2) (=)
1) (<)
3) (>)
4) (≥)
2002
C001
LDA
#02000
CMP
2002
2009
0501
2010
0502
2011
0503
2009
Line No.
Instruction
Operand
Line No.
Instruction
Operand
0000
LDB
0001
0012
OUT
0501
0001
C
001 #099999 0003
0013
MPP
0002
LD
2002
0014
AND
2011
0003
LDA
C001
0015
OUT
0502
0004
CON
0016
LD
2002
0005
CMP
#01000
0017
LDA
C001
0006
CON
0018
CON
0007
MPS
0019
CMP
#02000
0008
AND
2009
0020
CON
0009
OUT
0500
0021
ANB
2009
0010
MRD
0022
OUT
0503
0011
AND
2010
:
:
CMP / @CMP
KVNKA Chap 02_4cP.p65
08.3.11, 0:02 PM
146