Chapter 6 Instruction and Flag List
XBC E-Type Main Unit 6-201 Ve r. 1
6.32 Data Process Instruction
6.32.1 BSUM, BSUMP, DBSUM, DBSUMP
Instruction
Step
P M K F L T C S Z D.x
R.x
U N D R
2~4 - O -
Address of word data to count the number of 1s
Address to save the counting result
[Flag Setting]
To be set if operation result is Zero
1) BSUM (Bit Summary)
(1) Saves the result of the counted bit number of 1s among specified word data S1 in D using Hexadecimal.
(2) When operation result is 0, Zero Flag will be set.
(Number of 1's count)
(Number of 1's is 8)
Execution
b15
0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0D
b0
b15 b0
0
1 1 0
0 1
0
1 0
1 1
1
0 0 0 1S
2) DBSUM (Double Bit Summary)
(1) Saves the result of the counted bit number of 1s among specified double word data S1 in D using
Hexadecimal.
(2) When operation result is 0, Zero Flag will be set.
1 0 0 1
0 1 1 0 0 1
0 0 1 0 1 0S h964A
Count number of ‘1’
Number of ‘1’ is 12
Execution
b16b32
b15
0 0 0
0 0 0 0 0 0 0 0
0 1 1 0 0D h000C
b0
b15 b0
0
0 0 1 0 0 1 0 0
0 1 1 1 0 0 0 h1238
3) Program Example
(1) For D1000=h3333, if Input Signal P00000 is changed from Off to On status, It saves 8 in D1100.