132
4
4 Instructions4.4.4 Table Operations
MEAN: Mean value calculation
◆
Overview
When driving conditions are met, the MEAN instruction calculates the mean value of K data entries from
head address S. The result is stored in D.
MEAN S D n
Mean value
calculation
Applicable model:
H3U
S
Data
head
address
Head address of word elements that store the data
entries whose mean value is to be calculated
16-bit instruction
(7 steps)
MEAN:
Continuous
execution
MEANP: Pulse
execution
32-bit instruction
(13 steps)
DMEAN: Continuous
execution
DMEANP: Pulse
execution
D
Mean
value
Address of the word element that stores the mean value
n
Data
length
Immediate value: K = 1–64
◆
Operands
Operand
Bit Element Word Element
System·User System·User Bit Designation Indexed Address Constant
Real
Number
S X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
D X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
n X Y M T C S SM D R T C SD KnX KnY KnM KnS KnSM
V,Z
Modication K H E
Note: The elements in gray background are supported.
◆
Function
The mean value of N variables from head address S is calculated by dividing the sum of the variables by n.
The result is stored in D.
The remainder (if any) of the calculation result is discarded.
A calculation error will occur when n exceeds the range 1 to 64.
Example:
X0
(D10 + D11 + D12 + D13)/4 = D20
Assume that D10 = K5, D11 = K5, D12 = K15, and D13 = K52.
Then D20 = K19, and the remainder 1 is discarded.
ǒMEAN D10 D20 K4Ǔ
S
D
n
M8025: Cumulative summation ag
When M8025 = OFF, the result is as shown in the preceding gure.
When M8025 = ON, the cumulative sum of the preceding variables is stored in D+1 and D+2.
As shown in the preceding example, the sum of D10, D11, D12, and D13 is stored in (D22, D21), which
occupies 32 bits.