The Average instruction is a ladder logic rung instruction that calculates the average of values in an array and places the calculated value in the Destination tag. The instruction is enabled when the preceding logic is true and disabled otherwise.
The Average ladder instruction uses the Control data type to calculate the average.
Insure the Length and Position does not travel outside the array boundaries.
List of possible argumentsARRAY TAG & DIMENSION TO VARY must be an array and the dimension of the array must be pointed out. ARRAY can be one of the following data types
- DIM TO VARY Must be a Constant with one of these values 0,1,2
If the Position or Length is less than zero a major fault will occur. Make sure the length is less than or equal to the actual array size. If the Length value is set higher than the length of the array the destination value will be wrong.
Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.