5 Applied Instructions and Basic Usage
DVP-20PM Application Manual
5-66
API
Applicable model
20PM
45
D
D
MEAN
P
P
Mean
Bit device Word device
X Y M S K H KnX KnY KnM KnS T C D V Z
S
* *
* * * * * * *
D
* * * * * * * *
n
* *
* * * * * * * * *
Note: The instruction supports V devices and Z devices. (If the 16-bit
instruction is used, Z devices can not be used. If the 32-bit
instruction is used, V devices can not be used.)
Please refer to specifications for more information about device
ranges.
If KnX/KnY/KnM/KnS is used, it is suggested that X/devices/Y
devices/M device numbers/S device numbers should start from a
number which is a multiple of 16 in the octal numeral system or in
the decimal numeral system, e.g. K1X0 (octal numeral system),
K4SY20 (octal numeral system), K1M0 (decimal numeral system),
and K4S16 (decimal numeral system).
16-bit instruction (7 steps)
MEAN
Continuity
instruction
MEAN P
Pulse
instruction
32-bit instruction (13 steps)
DMEAN
Continuity
instruction
DMEANP
Pulse
instruction
Flag: None
Explanation
After the values in the n devices star
ting from S are added up, the mean of the
sum is stored in D.
S: Initial device; D: Device in which a mean is stored; n: Number of devices
If a remainder appears in a calculation, it will be left out.
If S is not in a valid range, only the devices in the valid range will be
processed.
If n is not in the range of 1 to 64, an operation error will occur.
n=1~64
Example
When X10 is ON, the values in the three registers starting from D0 are added
up. After the values are added up, the sum will be divided by 3. The quotient is
stored in D10, and the remainder is left out.
X10
MEAN D0
D10
K3
D0
D1
D2
D10
K112
K100
K113
K125
(D0+D1+D2)/
D10
After the instruction
is executed
The quotient 2 is left out.