Mitsubishi Electronics FX3G User Manual

Page of 964
326
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
12 Data Operation – FNC 40 to FNC 49
12.4 FNC 43 – SUM / Sum of Active Bits
2. 32-bit operation (DSUM and DSUMP)
The number of bits in the ON status in [
+1, 
] is counted, and stored to 
.
• The number of bits in the ON status are stored in 
, and K0 is stored in 
+1.
• When all bits are OFF in [
+1, 
], the zero flag M8020 turns ON.
3. Operation result 
 according to the 
 value (in 16-bit operation)
M8020 
(zero
flag)
Bit device
Word device
b15
b14
b13
b12
b11
b10
b9
b8
b7
b6
b5
b4
b3
b2
b1
b0
Decimal
Hexadecimal
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0000
0
ON
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0001
1
OFF
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
2
0002
1
OFF
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
3
0003
2
OFF
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
4
0004
1
OFF
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
5
0005
2
OFF
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
6
0006
2
OFF
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
7
0007
3
OFF
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
8
0008
1
OFF
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
9
0009
2
OFF
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
10
000A
2
OFF
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
11
000B
3
OFF
OFF
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
−5
FFFB
15
OFF
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
−4
FFFC
14
OFF
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
−3
FFFD
15
OFF
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
−2
FFFE
15
OFF
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
−1
FFFF
16
OFF
  
D
1
   
S
  
D
1
   
S
  
D
1
   
D
  
D
1
   
D
  
D
1
   
D
  
D
1
   
S
  
D
1
   
S
[          +1,          ]
Command
input
FNC 43
DSUM
Before
execution
After
execution
K21847
K0
K21847
K9
K0
K0
Number of bits in
the ON status in
+1,
Word data
32-bit data
K0 is written
0 0 0 0 0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
b16
b17
b31
b0
b1
b2
b3
b4
b5
b6
b7
b8
b9
b10
b11
b12
b13
b14
b15
b16
b17
b31
b0
b1
b2
b3
b4
b5
b6
b7
b8
b9
b10
b11
b12
b13
b14
b15
32 16 8 4 2 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
0 0 0 0 0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
2
3
4
5
6
7
8
9
(Number of "1" (ON))
  
D
1
   
D
  
D
1
   
S
  S
  D