AVG
Calculates the average between 1 and 10 values.

Parameter values for the AVG function:
Parameter | Data Type | Description |
---|---|---|
N | DINT | Specifies the number of values to average. For example, when N=3, returns the average of PV1, PV2, and PV3. |
PV1...PV10 | REAL | These inputs use REAL values. Infinity or Not a Number (NaN) values are not
supported by the inputs. |
OUT | REAL | Average value of the specified number of inputs. |
When the value of N is out of range, OUT returns the average of all ten input
values and the
ERRSTAT
Param error count increments.When an overflow errors
occurs during execution of the function, OUT sets to PV1 and the
ERRSTAT
Overflow
error counter increments.When an underflow error occurs, OUT sets to zero and the
ERRSTAT
Underflow error counter increments.Function
Block Diagram Example

Structured Text Example
AverageV
:= AVG(4, PV1, PV2, PV3, PV4, PV5, PV6, PV7, PV8, PV9, PV10);
Provide Feedback