M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.9 Data Processing Instructions
Operation errors
There are no arithmetic errors associated with the SUM(P) or DSUM(P) instructions.
Program example
The following program stores the number of bits from X8 to X17 which are ON when X10 is ON at D0.
X10
0
5
x17
0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 1
D0
The following program stores the number of bits from D100 and D101 which are ON when X10 is ON at D0.
X10
0
5
b31
b28b27
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0
D100,D101
[Ladder mode]
SUM K4X8 D0
END
x8
Stores the total number of bits at 1 in D0.
7
[Ladder mode]
DSUMP D100 D0
END
b24b23
b20b19
b16b15
b12b11
Stores the total number of bits at 1 in D0.
15
D1,D0
Steps
0
1
5
Steps
0
1
5
b8 b7
b4 b3
b0
299
[List mode]
Inst.
Device
LD
X10
SUM
K4X8
D0
END
[List mode]
Inst.
Device
LD
X10
DSUMP
D100
D0
END
IB-1501667-B