
EAF
Process Control Instructions
Chapter 16
16-42
Averaging
The averaging instruction determines the arithmetic average of a group of
six digit BCD values. The maximum number of values you can average is
999 or is limited by the data table area available. The Averaging
instruction uses the formula:
y
+
ȍ
i
+
1
X
i
n
n
where:
X
i
=
six digit signed BCD values
y =
the average of the values
n =
the number of values
Entry and Display of Input and Result Values
Figure 16.12 shows one method you can use to enter values and display
results of the six digit averaging. Although there are several techniques for
accomplishing this, we chose Get instructions.
Be careful not to select data and result addresses so that they overlap.
Figure 16.12
6Digit Averaging Ladder Diagram
EXECUTE AUX
FUNCTION NUMBER:
DATA ADDR:
RESULT ADDR:
06
0040
0160
00
0030
005
G
0031
005
G
FUNCTION
150
EN
FILE TO FILE MOVE
COUNTER ADDR:
POSITION:
FILE LENGTH:
0033
001
021
FILE A:
FILE R:
RATE PER SCAN
0040-0064
0160-0204
021
DN
0033
17
0033
15
000
0162
003
G
0163
000
G
0161
0164
000
G
010
00
G
Here is a description of the ladder diagram. This programming example
averages five values and stops.