388 Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Chapter 8 Array (File)/Misc. Instructions (FAL, FSC, COP, CPS, FLL, AVE, SRT, STD, SIZE)
Example 1: Sort int _array, which is DINT[4,5].
Relay Ladder
Structured Text
control_1.LEN := 4;
control_1.POS := 0;
SRT(int_array[0,2],0,control_1);
Example 2: Sort int _array, which is DINT[4,5].
Dimension 1
Dimension 0
0
20 19
18 17 16
15 14
13 12 11
10 9
876
54
321
1
2
3
01234
Dimension 1
Dimension 0
0
20 19 3 17 16
15 14
81211
10 9 13 7 6
541821
1
2
3
01234
Before
After
Sub
s
cripts
Su
bsc
ripts
Dimension 1
Dimension 0
0
20 19 18 17 16
15 14 13 12 11
10 9 8 7 6
54321
1
2
3
01234
Dimension 1
Dimension 0
0
20 19 18 17 16
15 14 13 12 11
678910
54321
1
2
3
01234
Before
After
Sub
sc
r
ip
t
s
Subscr
i
pts