5 Applied Instructions and Basic Usage
DVP-20PM Application Manual
5-45
API
Applicable model
20PM
28
D
D
WXOR
P
P
Logical exclusive OR operation
Bit device Word device
X Y M S K H KnX KnY KnM KnS T C D V Z
S1
* *
* * * * * * * * *
S2
* *
* * * * * * * * *
D
* * * * * * * *
Note: The instruction supports V devices and Z devices. (If the 16-bit
instruction is used, Z devices can not be used. If the 32-bit
instruction is used, V devices can not be used.)
Please refer to specifications for more information about device
ranges.
16-bit instruction (7 steps)
WXOR
Continuity
instruction
WXORP
Pulse
instruction
32-bit instruction (9 steps)
DWXOR
Continuity
instruction
DWXORP
Pulse
instruction
Flag: None
Explanation
A logical XO
R operator takes the binary representations in S
1
and S
2
, and
performs the logical exclusive OR operation on each pair of corresponding bits.
The operation result is stored in D.
S
1
: Source device 1; S
2
: Source device 2; D: Operation result
The result in each position is 1 if the two bits are different, and 0 if they are the
same.
Example 1
When X0 is ON, a logical XOR operator takes the values in the 16-bit device
D0 and the 16-bit device D2, and performs the exclusive OR operation on each
pair of corresponding bits, and the operation result is stored in D4.
X0
WXOR D0 D2 D4
Before the instruction
is executed
After the instruction
is executed
011111 1
0000 0 0 0111
00 00
11
WXOR
b15 b0
S
1
S
2
D
D0
D2
D4
000000011
011111
111 111
0000
Example 2
When X1 is ON, a logical XOR operator takes the values in the 32-bit device
(D11, D10) and the 32-bit device (D21, D20), and performs the logical
exclusive OR operation on each pair of corresponding bits, and the operation
result is stored in (D41, D40).
X1
DWXOR
D10 D20 D40
Before the instruction
is executed
After the instruction
is executed
DWXOR
b15 b0b31
S
1
S
2
D
D11 D10
D21 D20
D41 D40
11111111
0000
1111
000
00
11 111
00000000
11111
11111111 1111
000 00 000 0 00
0000
111 11 1 111 11111111 111 11
00 00000 0