Mitsubishi MELSEC-Q/L Programming Manual page 359

Table of Contents

Advertisement

Function
SUM
From the 16-bit data in the device designated by
designated by
.
D
DSUM
From the 32-bit data in the device designated by
designated by
.
D
Operation Error
(1) There is no operation error in the SUM(P) or DSUM(P) instruction.
Program Example
(1) The following program stores the number of bits which are ON from X8 to X17 into D0 when X10 is turned ON.
[Ladder Mode]
[Operation]
X17
0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1
Stores the total number of bits
where 1 is set at D0.
D0
7
(2) The following program stores the number of bits which are ON in D100 and D101 into D0 when X10 is turned ON.
[Ladder Mode]
, stores the total number of bits where 1 is set, in the device
S
b15
b8
b7
S
1 1 0 0 1 0 1 1 0 0 1 1 0 0 0 1
Total number of bits where 1 is set
b15
b8
b7
D
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
Stores the total number of bits where 1 is set in BIN.
(There are 8 bits where 1 is set in the example.)
, stores the total number of bits where 1 is set, in the device
S
+1
S
b31
b16b15
1 0 0 1 1 1 0 0 1 0 1 0 0 1 1 1
b15
b8
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
D
Stores the total number of bits where 1 is set in BIN.
(There are 16 bits where 1 is set in the example.)
[List Mode]
Step
X8
[List Mode]
Step
SUM, SUMP, DSUM, DSUMP
b0
b0
S
b0
0 0 0 1 0 0 0 0 1 1 1 1 0 1 1 0
Total number of bits where 1 is set
b7
b0
Instruction
Device
Instruction
Device
1
2
3
4
4
6
7
8
357

Advertisement

Table of Contents
loading

Table of Contents