Mitsubishi Electronics FX3GC User Manual

Page of 964
544
FX
3S
/FX
3G
/FX
3GC
/FX
3U
/FX
3UC
 Series
Programming Manual - Basic & Applied Instruction Edition
19 Data Operation 2 – FNC140 to FNC149
19.7 FNC149 – SORT2 / Sort Tabulated Data 2
The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4
columns (m1 = K3, m2 = K4). For the sorting result data table, understand 
 as 
.
• Set the sorting order by setting M8165 to ON or OFF.
• When the command input turns ON, data sorting is started. Data sorting is completed after "m1" scans, and the 
instruction execution complete flag M8029 is set to ON.
→ For the instruction execution complete flag use method, refer to Subsection 6.5.2.
2. 32-bit operation (DSORT2)
In the data table (sorting source) having (m1 
× m2) points from [
+1, 
], data lines are sorted in the
ascending or descending order based on the group data in the column No. "n", and the result is stored in the data table
(sorting result) having (m1 
× m2) points from [
+1, 
].
→ For operation examples, refer to next page.
The data table configuration is explained in an example in which the sorting source data table has 3 lines and 4
columns (m1 = K3, m2 = K4). For the sorting result data table, understand 
 as 
.
• Set the sorting order by setting M8165 to ON or OFF.
• When a data register D or extension register (R) is used for "m1", the data length is 32 bits.
For example, when "m1" is specified in D0, "m1" is 32-bit data stored in [D1, D0].
• When the command input turns ON, data sorting is started. Data sorting is completed after "m1" scans, and the 
instruction execution complete flag M8029 is set to ON.
→ For the instruction execution complete flag use method, refer to Subsection 6.5.2.
Column No.
Number of groups (m2 = K4)
1
2
3
4
Line No.
Control number
Height
Weight
Age
Number of
data
m1 =K3
1
+1
+2
+3
2
+4
+5
+6
+7
3
+8
+9
+10
+11
Sorting order
M8165=ON
Descending order
M8165=OFF
Ascending order
Column No.
Number of groups (m2 = K4)
1
2
3
4
Line No.
Control number
Height
Weight
Age
Number of
data
m1 =K3
1
[
+1,
]
[
+3,
+2]
[
+5,
+4]
[
+7,
+6]
2
[
+9,
+8]
[
+11,
+10]
[
+13,
+12]
[
+15,
+14]
3
[
+17,
+16]
[
+19,
+18]
[
+21,
+20]
[
+23,
+22]
Sorting order
M8165=ON
Descending order
M8165=OFF
Ascending order
S
D
S
S
S
S
S
S
S
S
S
S
S
S
S
S
D
D
Command
input
FNC149
DSORT2
m1
m2
S
n
D
M8029
M{{
Instruction execution complete
flag for SORT2 instruction
Instruction execution complete flag
S
D
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S
S