Relay Ladder; Structured Text - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Chapter 8
Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)
0
1
Dimension 0
2
3
384
Example 2:
Average array_dint, which is DINT[4,5].
Dimension 1
0
1
2
3
4
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

Relay Ladder

Structured Text

SIZE(array_dint,1,length);
sum := 0;
FOR position = 0 TO (length-1) DO
sum := sum + array_dint[position];
END_FOR;
dint_ave := sum / length;
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
5
+ + + +
4
3
2
--------------------------------------- -
AVE
=
5
dint_ave = 3
1
15
----- -
=
=
3
5

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents