KEYENCE Visual KV Series User Manual
Page 171

2.4 Instruction Details
1
2
3-147
Chapter 2 Instructions
Operands
Key operation
Arithmetic flag
2009 Turns ON when the result of the CMP operation is negative. Turns OFF at
other times.
2010 Turns ON when the result of the CMP operation is "0". Turns OFF at other
times.
2011 Turns ON when the result of the CMP operation is positive. Turns OFF at
other times.
2012 The DM or relay indirectly addressed with #TM is out of range.
➮ "Indirect addressing" (p. 3-127)
Description
•
As shown in the above example, the CMP instruction is used by connecting the
special utility relay (2009 to 2011) immediately after the instruction.
•
The operation of the CMP instruction varies depending on the contents of the
internal register.
Note: Special utility relays 2009 to 2011 are used as arithmetic flags. The function
varies depending on the execution of other arithmetic instructions.
Tips
An operand is compared with the internal register using the following program.
When the internal register is assumed as "a" and the operand is "b" such as , the
statuses of the special utility relays are as follows:
@
#,$
FUN
FUN
LDB
4
RES
0
ENT
R-SRCH
ENT
R-SRCH
Operand
#00999
CMP
DM0000
LDA
2009
a
LDA
CMP
b
2009
a < b,
a ≤ b,
a = b,
a ≥ b,
a > b
2011
2010
2009
2011
CMP / @CMP
Visual KV
KV-300
KV-10/16
KV-24/40/80
DM0000 to DM1999 DM0000 to DM9999 DM0000 to DM0999 DM0000 to DM1999
TM00 to TM31
TM00 to TM31
TM00 to TM31
TM00 to TM31
#00000 to #65535
#00000 to #65535
#00000 to #65535
#00000 to #65535
$0000 to $FFFF
$0000 to $FFFF
$0000 to $FFFF
$0000 to $FFFF
#TM00 to #TM29
#TM00 to #TM29
#TM00 to #TM29
#TM00 to #TM29
KVNKA Chap 02_4cP.p65
08.3.11, 0:02 PM
147