Chapter 7 Second Development PlatformVP3000
333
API Instruction code Operand Function
45 D MEAN P S, D, n
Mean
Type
Operand
Bit devices Word devices
16-bit instruction (7 steps)
MEAN
Continuous
execution
type
MEANP
Pulse
execution
type
32-bit instruction (13 steps)
DMEAN
Continuous
execution
type
DMEANP
Pulse
execution
type
Associated flag: none
X Y M K H KnX KnY KnM T C D
S
D
n
Caution for using operand
Valid range of operand n : n = 0–64
Description
S: start device to obtain mean value
D: destination device for storing mean value
n: The number of consecutive source devices used
Add the contents of n devices starting from S, obtain the mean value, and store in D.
Remainders in the operation will be truncated.
If n is out of the valid range, PLC will determine it as an “instruction operation error” and stop.
Example
When X10 = ON, the contents in 3 (n = 3) registers starting from D0 will be summed and then
divided by 3. The obtained mean value will be stored in D10 and the remainder will be truncated.
X10
MEAN D0
D10
K3