Chapter 7 Second Development PlatformVP3000
301
API Instruction code Operand Function
11 D ZCP P S
1
, S
2
, S, D Zone compare
Type
Operand
Bit devices Word devices
16-bit instruction (9 steps)
ZCP
Continuous
execution
type
ZCPP
Pulse
execution
type
32-bit instruction (17 steps)
DZCP
Continuous
execution
type
DZCPP
Pulse
execution
type
Associated flag: none
X Y M K H KnX KnY KnM T C D
S
1
S
2
S
D
Caution for using operand
The content in S
1
should be smaller than the content in S
2
.
Operand D occupies 3 consecutive devices.
Description
S
1
: lower bound of zone comparison
S
2
: upper bound of zone comparison
S: comparison value
D: comparison result
S is compared with its S
1
and S
2
, and the result is stored in D.
When S
1
> S
2
, the instruction performs comparison by using S
1
as the lower / upper bound.
The two comparison values are compared algebraically and the two values are signed binary
values. When b15 = 1 in 16-bit instruction, the comparison regards the value as negative
binary values.
Example
Designate device M0, and operand D automatically occupies M0, M1 and M2.
When X0 = ON, ZCP instruction is executed, and one of M0, M1, and M2 will be ON. When
X0 = OFF, ZCP instruction is not executed, and M0, M1, and M2 remain their status before X0
= OFF.
If you need to obtain a comparison result with ≥, ≤, and ≠, make a serial-parallel connection
between M0–M2.
To clear the comparison result, use RST or ZRST instruction.
X0
M0
RST
M1
RST
M2
RST
X0
M0
ZRST
M2