Mitsubishi Electronics FXCPU Video Game Controller User Manual


 
11 Applied Instructions (Data Operation)
11.4 SUM / Sum of Active Bits
237
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
11
Applied Instructions
(Data Operation)
12
Applied Instructions
(High Speed
Processing)
13
Applied Instructions
(Handy
Instruction)
14
Applied Instructions
(External FX I/O
Device)
15
Applied Instructions
(External Device
(optional device))
16
Applied Instructions
(External Device)
17
Applied Instructions
(Data Transfer 2)
18
Applied Instructions
(Floating Point)
19
Applied Instructions
(Data Operation 2)
20
Applied Instructions
(Positioning
Control)
Function and operation explanation
1. 16-bit operation (SUM ,SUMP)
The number of bits in the ON status in the device specified by is counted, and stored to the device
specified by .
When all bits are 0 (OFF) in the device specified by , the zero flag M8020 turns ON.
2. 32-bit operation (DSUM, DSUMP)
The number of bits in the ON status in the device specified by is counted, and stored to the device
specified by .
The number of bits in the ON status is stored in the device specified by , and K0 is stored in +1.
When all bits are 0 (OFF) in the device specified by , the zero flag M8020 turns ON.
Number of bits in the ON status in
ds
Before
execution
After
execution
K21847
K0
K21847
K9
Word data
16-bit data
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
0000000000000000
b0b1b2b3b4b5b6b7b8b9
b10b11b12b13b14b15
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
b0b1b2b3b4b5b6b7b8b9
b10b11b12b13b14b15
1001000000000000
123456789 (Number of "1" (ON))
32 16 8 4 2 1
Command input
SUM data
Resulting data
SUM
EN
s
ENO
d
d
s
s
d
Command input
SUM data Resulting data
DSUM
EN
s
ENO
d
+1,
K0 is written.
ds
s
d
K21847
K0
K21847
K9
K0
K0
Word data
32-bit data
b16b17b31 ···
b0b1b2b3b4b5b6b7b8b9
b10b11b12b13b14b15
b16b17b31 ···
b0b1b2b3b4b5b6b7b8b9
b10b11b12b13b14b15
32 16 8 4 2 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 10 0 0 0 0
0000000000000000
00000
123456789
(Number of "1" (ON))
1001000000000000 1001000000000000
0 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
s
d
d
s
Number of bits in the ON status in [ +1, ]
Before
execution
After
execution