Справочник Пользователя для Mitsubishi Electronics FX2NC

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-46
5.5.6
MEAN (FNC 45)
Operation:
The range of source data is defined by 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
range is summed and then divided by the number
of devices summed, i.e. n. This generates an
i n t e g e r   m e a n   v a l u e   w h i c h   i s   s t o r e d   i n   t h e
destination device (D). The remainder of the
calculated mean is ignored.
Points to note:
If the source area specified is actually smaller than the physically available area, then only 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 displayed. This can cause confusion as the mean value calculated manually using this
original n value will be different from that which is displayed.
If the value of nis specified outside of the stated range (1 to 64) an error is generated.
Mnemonic
Function 
Operands
Program steps
S
D
n
MEAN
FNC 45
(Mean)
Calculates the
mean of a range
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
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
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