FX Series Programmable Controlers Applied Instructions 5
5-58
5.5.4 SUM (FNC 43)
Operation:
The number of active (ON) bits within the source
device (S), i.e. bits which have a value of “1" are
counted. The count is stored in the destination
register (D). If a double word format is used, both the
source and destination devices use 32 bit, double
registers. The destination device will always have its
upper 16 bits set to 0 (zero) as the counted value can
never be more than 32.
If no bits are ON then zero flag, M8020 is set.
Mnemonic Function
Operands
Program steps
SD
SUM
FNC 43
(
Sum of
active bits)
The number
(quantity) of
active bits in the
source data is
stored in the
destination device
K, H,
KnX, KnY, KnM, KnS,
T, C, D, V, Z
KnY, KnM, KnS,
T, C, D, V, Z
SUM,SUMP:
7steps
DSUM,
DSUMP:
9steps
FX
1S
FX
1N
FX
2N
FX
2NC
PULSE-P
16 BIT OPERATION
32 BIT OPERATION
Flags
Zero M8020
X0
D 2
[ S ] [ D ]
D 0SUM
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1
0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1
b15 b0
D 0
8421
..
D 2