210
4
4 Instructions4.5.5 Other Data Processing
◆
Function
The status of the nth bit in S is checked. The result is stored in D.
Example:
M10 remains in the current state when X10 switches from ON to OFF.
X10
010101010101010
M10 is set when the (n = 14)th bit in D10 is 1.
b0
010101010101010
1
b
14
D10
M 10=ON
M 10= OFF
ǒBON D10 M10 K14Ǔ
S
D
n
0
1
M10 is reset when the (n = 14)th bit in D10 is 0.
D10
n
b0b14
SUM: Total number of ON bits
◆
Overview
When driving conditions are met, the SUM instruction counts the ON bits (with a value of 1) of the binary
data in S. The result is stored in D.
SUM S D
Total number of
ON bits
Applicable model:
H3U
S
Data to be
counted
Data to be counted, or address of the element that
stores the data
16-bit instruction
(5 steps)
SUM: Continuous
execution
SUMP: Pulse
execution
32-bit instruction (9
steps)
DSUM: Continuous
execution
DSUMP: Pulse
execution
D
Counting
result
Address of the element that stores the data
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
ON bits (with a value of 1) of the BIN data in S are counted. The result is stored in D.
When DSUM and DSUMP are executed, the number of bits with a value of 1 among the 32 bits in (S+1, S)
is written to D. All bits in D+1 are set to 0.
If all bits in S are 0, the zero ag M8020 is set to ON.