Mitsubishi Electronics FX2C Home Theater Server User Manual


 
FX Series Programmable Controlers Applied Instructions 5
5-45
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
re
g
ister (D). If a double word format is used, both the
source and destination devices use 32 bit, double
re
g
isters. The destination device will alwa
y
s 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 fla
g
, M8020 is set.
5.5.5 BON (FNC 44)
Operation:
A sin
g
le bit position (n) is specified from within a
source device/area (S). n could be re
g
arded as a
specified offset from the source head address (S),
i.e. 0 (zero) bein
g
the first device (a 0 offset) where
as an offset of 15 would actuall
y
be the 16th device.
If the identified bit becomes active, i.e. ON, the
destination device (D) is activated to “fla
g
” the new
status.
The destination device could be said to act as a
mirror to the status of the selected bit source.
Mnemonic Function
Operands
Program steps
SD
SUM
FNC 43
(
Sum of
active bits)
The number
(quantit
y
) 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:
7 steps
DSUM,
DSUMP:
9 steps
Mnemonic Function
Operands
Program steps
SD n
BON
FNC 44
(
Check
specified
bit status)
The status of the
specified bit in the
source device is
indicated at the
destination
K, H,
KnX, KnY,
KnM, KnS,
T, C, D, V,
Z
Y, M, S K,H,
Note:
16 bit operation
n=0 to 15
32 bit operation
n=0 to 31
BON, BONP:
7steps
DBONP,
DBON:
13 steps
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
X0
M 0 K 15
[ S ] [ D ]
D 10
[ n ]
BON
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
b15
b0
D 10
0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
b15 = 0, M0 = 0
b15 = 1, M0 = 1