Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 381
Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE) Chapter 8
CONTROL Structure
Description: The AVE instruction calculates the average of a set of values.
Arithmetic Status Flags: Arithmetic status flags are affected.
Fault Conditions:
Mnemonic Data Type Description
.EN BOOL The enable bit indicates that the AVE instruction is enabled.
.DN BOOL The done bit is set when the instruction has operated on the last element in the array (.POS = .LEN).
.ER BOOL The error bit is set if the instruction generates an overflow. The instruction stops executing until the
program clears the .ER bit. The position of the element that caused the overflow is stored in the .POS
value.
.LEN DINT The length specifies the number of elements in the array on which the instruction operates.
.POS DINT The position contains the position of the current element that the instruction is accessing.
Make sure the Length does not cause the instruction to exceed
the specified Dimension to vary. If this happens, the Destination
will be incorrect.
A Major Fault Will Occur If Fault Type Fault Code
.POS < 0 or .LEN < 0 4 21
Dimension to vary does not exist for the
specified array
420