5 Categories and Use of Basic Application Instructions API 45 Operands: S : Source device D : Destination for storing result n : Number of consecutive device from S Explanations: 1. The instruction obtains the mean value from n consecutive registers from S and stores the value in D . 2. Remainders in the operation will be ignored. 3. If S is not within the valid range, only those addresses within the valid range will be processed. 4. If n is out of the valid range (1~64), PLC will determine it as an “instruction operation error”. 5. When MEAN is used as 16-bit instruction, Z device cannot be adopted; when MEAN is used as 32-bit instruction, V device cannot be adopted. 6.
When specifying the bit device of KnX(Y/M/S), the starting No. should be a multiple of 16 in octal or decimal format. For example, K1X0, K4Y20 (octal); K1M0, K4S16 (decimal) 7. Valid range of operand n : n = 1~64 Program Example: When X10 = ON, the contents in 3 (n = 3) registers starting from D0 will be summed and then divided by 3 to obtain the mean value. The result will be stored in D10 and the remainder will be left out X10 (D0+D1+D2)/3 D10 D0 K100 D1 K113 K112 D10 Remainder = 3, left out D2 K125 DVP-PM Application Manual 5-65 Mnemonic Operands Function Controllers 20PM 10PM D MEAN P Mean Type OP Bit Devices Word devices Program Steps X Y M S K H KnX KnY KnM KnS T C D E F MEAN, MEANP:
7 steps DMEAN, DMEANP: 13 steps S * * * * * * * * * D * * * * * * * * n * * * * * * * * * * * MEAN D0 D10 K3