Справочник Пользователя для Mitsubishi Electronics FX

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-77
5.7.10
SORT (FNC 69)
Operation:
This instruction constructs a data table of m
1
records with m
2  
fields having a start or head
address of S. Then the data in field nis sorted in to
numerical order while retaining each individual
records integrity. The resulting (new) data table is stored from destination device D.
Points to note:
a) When a sort occurs each record is sorted in to ascending order based on the data in the
selected sort field n.
b) The source (S) and destination (D) areas can be the same BUT if the areas are chosen to
be different, there should be no overlap between the areas occupied by the tables.
c) Once the SORT operation has been completed the ‘Operation Complete Flag’ M8029 is
turned ON. For the complete sort of a data table the SORT instruction will be processed
m1times.
d) During a SORT operation, the data in the SORT table must not be changed. If the data is
changed, this may result in an incorrectly sorted table.
e) The SORT instruction may only be used ONCE in a program. 
From the example instruction and the ‘data table’ below left, the following data manipulation
will occur when nis set to the identified field
Mnemonic
Function 
Operands
Program steps
S
m
1
m
2
D
n
SORT
FNC 69
(SORT
Tabulated
Data)
Data in a defined
table can be
sorted on selected 
fields while 
retaining record
integrity
D
K, H
Note:
m1= 1 to 32
m2= 1 to 6
D
K, H
D
Note:
n = 1 to
m2
SORT:
11 steps 
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
FLAGS
Operation
Complete M8029
X21
SORT
D100
K 4
[ S ]
[ D ]
K 3
D100
K 2
n
m1 m2
4
1
2
3
1
2
3
FIELD (m2)
(D100)
32
(D101)
74
(D102)
100
(D103)
7
(D104)
162
(D105)
6
(D106)
80
(D107)
34
(D108)
4
(D109)
200
(D110)
62
(D111)
6
R
E
C
O
R
D
(m
1
)
4
1
2
3
1
2
3
FIELD (m2)
(D100)
74
(D101)
7
(D102)
100
(D103)
32
(D104)
6
(D105)
34
(D106)
80
(D107)
162
(D108)
200
(D109)
6
(D110)
62
(D111)
4
R
E
C
O
R
D
(m
1
)
4
1
2
3
1
2
3
FIELD (m2)
(D100)
7
(D101)
32
(D102)
74
(D103)
100
(D104)
34
(D105)
162
(D106)
6
(D107)
80
(D108)
6
(D109)
4
(D110)
200
(D111)
62
R
E
C
O
R
D
(m
1
)
Original 
Table1st table sort when n= 2 
2nd table sort when n=1