EasyManuals Logo
Home>Allen-Bradley>Controller>Logix5000

Allen-Bradley Logix5000 Reference Manual

Allen-Bradley Logix5000
708 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #380 background imageLoading...
Page #380 background image
380 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 8 Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)
File Average (AVE)
The AVE instruction calculates the average of a set of values.
Operands:
Relay Ladder
Structured Text
Structured text does not have an AVE instruction, but you can achieve the same
results by using a SIZE instruction and a FOR...DO or other loop construct.
SIZE(array,0,length);
sum := 0;
FOR position = 0 TO length-1 DO
sum := sum + array[position];
END_FOR;
destination := sum / length;
See Structured Text Programming
for information on the syntax of constructs
within structured text.
Operand Type Format Description
Array SINT
INT
DINT
REAL
Array tag Find the average of the values in this array
Specify the first element of the group of elements
to average
Do not use CONTROL.POS in the subscript
Dimension to
vary
DINT Immediate
(0, 1, 2)
Which dimension to use
Depending on the number of dimensions, the order
is:
array[dim_0,dim_1,dim_2]
array[dim_0,dim_1]
array[dim_0]
Destination SINT
INT
DINT
REAL
Tag Result of the operation
Control CONTROL Tag Control structure for the operation
Length DINT Immediate Number of elements of the array to average
Position DINT Immediate Current element in the array
Initial value is typically 0

Table of Contents

Other manuals for Allen-Bradley Logix5000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Allen-Bradley Logix5000 and is the answer not in the manual?

Allen-Bradley Logix5000 Specifications

General IconGeneral
BrandAllen-Bradley
ModelLogix5000
CategoryController
LanguageEnglish

Related product manuals