7 APPLICATION INSTRUCTIONS
7.5 Data Processing Instructions
421
7
16-bit data bit check, 32-bit data check
SUM(P), DSUM(P)
■SUM
• From the 16-bit data in the device designated by (S), stores the total number of bits where 1 is set, in the device designated
by (D).
■DSUM
• From the 32-bit data in the device designated by (S), stores the total number of bits where 1 is set, in the device designated
by (D).
• There is no operation error in the SUM(P) or DSUM(P) instruction.
(S): Head number of the devices where the total number of bits of "1" is counted (BIN 16/32 bits)
(D): Head number of the devices where the total number of the bits will be stored (BIN 16/32 bits)
Setting
data
Internal device R, ZR J\ U\G Zn Constant
K, H
Others
Bit Word Bit Word
(S)
(D)
Basic
Process
High
performance
Redundant
Universal
LCPU
Command
Command
P
S D
S D
SUM, DSUM
SUMP, DSUMP
indicates an instruction symbol of SUM/DSUM.
b15 b8
1
1 0 0 1 0 1 1 0 0 1 100 0 1
b0
b7
b15 b8
0
0 0 0 0 0 0 0 0 0 0 010 0 0
b0b7
Total number of bits where 1 is set
Stores the total number of bits where 1 is set in BIN.
(There are 8 bits where 1 is set in the example.)
S
D
S
D
1 0 0 1 1 1 0 0 1 0 1 001 1 1
b15 b8
0
0 0 0 0 0 0 0 0 0 0 100 0 0
b0b7
Total number of bits where 1 is set
Stores the total number of bits where 1 is set in BIN.
(There are 16 bits where 1 is set in the example.)
0 0 0 1 0 0 0 0 1 1 1 10 1 1 0
b31 b16b15 b0
S
+1