Mitsubishi Electronics FX2C Home Theater Server User Manual


 
FX Series Programmable Controlers Applied Instructions 5
5-46
5.5.6 MEAN (FNC 45)
Operation:
The ran
g
e of source data is defined b
y
operands
Sand n. S is the head address of the source data
and n specifies the number of consecutive source
devices used.
The value of all the devices within the source
ran
g
e is summed and then divided b
y
the number
of devices summed, i.e. n. This
g
enerates an
inte
g
er mean value which is stored in the
destination device (D). The remainder of the
calculated mean is i
g
nored.
Points to note:
If the source area specified is actuall
y
smaller than the ph
y
sicall
y
available area, then onl
y
the
available devices are used. The actual value of n used to calculate the mean will reflect the
used, available devices. However, the value for n which was entered into the instruction will
still be displa
y
ed. This can cause confusion as the mean value calculated manuall
y
usin
g
this
ori
g
inal n value will be different from that which is displa
y
ed.
If the value of nis specified outside of the stated ran
g
e (1 to 64) an error is
g
enerated.
Mnemonic Function
Operands
Program steps
SD n
MEAN
FNC 45
(Mean)
Calculates the
mean of a ran
g
e
of devices
KnX, KnY,
KnM, KnS,
T, C, D
KnY, KnM,
KnS,
T, C, D, V, Z
K,H,
Note:
n= 1 to 64
MEAN,
MEANP:
7 steps
DMEAN,
DMEANP:
13steps
X0
D 10 K 3
[ S ] [ D ]
D 0
[ n ]
MEAN
General rule
Example
D= =
( S
0
+ S
1
+ < + S
n
)
n
Σ
S
S
0
n
S
n
D10=
(D0) + (D1) + (Dn)
3