Mitsubishi Electronics FX3G User Manual

Page of 964
610
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
25 Block Data Operation – FNC190 to FNC199
25.3 FNC194~199 – BKCMP=, >, <, < >, <=, >= / Block Data Compare
Caution
• When using 32-bit counters (including 32-bit high-speed counters)
For comparing 32-bit counters and 32-bit high-speed counters (C200 to C255), make sure to use an instruction for 
32-bit operation (DBKCMP=, DBKCMP>, DBKCMP<, DBKCMP<>, DBKCMP<=, or DBKCMP>=).
If an instruction for 16-bit operation (BKCMP=, BKCMP>, BKCMP<, BKCMP<>, BKCMP<=, or BKCMP>=) is used, 
an operation error is caused (error code: K6705).
• Note that the 32-bit value [n+1, n] is valid when D or R is specified as "n" in a 32-bit instruction.
In the case of "DBKCMP = D0 D100 M0 R0", "n" is [R1, R0].
Errors
An operation error is caused in the following cases; The error flag M8067 turns ON, and the error code is stored in
D8067.
• When the range of "n" ("2n" in 32-bit operation) points starting from 
 and/or 
 exceeds the 
corresponding device range (error code: K6706)
• When the range of "n" points starting from 
 exceeds the corresponding device range (error code: K6706)
• When data registers starting from 
 specified as "D .b" overlap "n" ("2n" in 32-bit operation) points starting 
from 
 (error code: K6706)
• When data registers starting from 
 specified as "D .b" overlap "n" ("2n" in 32-bit operation) points starting 
from 
 (error code: K6706)
• When a 32-bit counter (C200 to C255) is specified in 
 and/or 
 in 16-bit operation (error code: K6705)
For comparing 32-bit counters, make sure to use an instruction for 32-bit operation (DBKCMP=, DBKCMP>, 
DBKCMP<, DBKCMP<>, DBKCMP<=, or DBKCMP>=).
Program example
1) In the program shown below, four 16-bit binary data starting from D100 are compared with four 16-bit binary data
starting from D200 by BKCMP= (FNC194) instruction when X020 is set to ON, and the comparison result is stored
in four points starting from M10.
When the comparison result is "ON (1)" in all of the four points starting from M10, Y000 is set to ON.
2) In the program shown below, the constant K1000 is compared with four data starting from D10 when X010 is set
to ON, and the comparison result is stored in b4 to b7 of D0.
  
S
1
  
S
2
   
D
   
D
  
S
1
   
D
  
S
2
  
S
1
  
S
2
D100
Comparison
result
=
K1000
K2000
K4000
K3000
D101
D102
D103
OFF
Y000
D200
K1000
K2000
K4000
K5000
D201
D202
D203
M10
ON
ON
ON
OFF
M11
M12
M13
X020
FNC194
BKCMP=
D100
D200
M10
END
K4
Y000
M8090
Block comparison signal
(When all of M10 to M13 are ON, Y000 is set to ON.)
<>
K1000
K2000
K1000
K2222
K1000
X010
FNC197
BKCMP<>
K1000
D10
D0.4
END
K4
D10
D11
D12
D13
b15
b7
b4
b0
D0 before
operation
0
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
b15
b7
b4
b0
D0 after
operation
0
0
0
0
1
0
0
1
0
1
0
0
0
0
1
0