537
FX3G/FX3U/FX3GC/FX3UC Series
Programming Manual - Basic & Applied Instruction Edition
19 Data Operation 2 – FNC140 to FNC149
19.7 FNC149 – SORT2 / Sort Tabulated Data 2
11
FNC30-FNC39
Rotation and
Shift
12
FNC40-FNC49
Data Operation
13
FNC50-FNC59
High-Speed
Processing
14
FMC60-FNC69
Handy
Instruction
15
FNC70-FNC79
External FX I/O
Device
16
FNC80-FNC89
External FX
Device
17
FNC100-FNC109
Data
Transfer 2
18
FNC110-FNC139
Floating Point
19
FNC140-FNC149
Data
Operation 2
20
FNC150-FNC159
Positioning
Control
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 Page 538.
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.
Number of groups (m2 = K4)
Column No. 1 2 3 4
Line No. Control number Height Weight Age
Number of
data (m1 =
3)
1
+1 +2 +3
2
+4 +5 +6 +7
3
+8 +9 +10 +11
Sorting order
M8165=ON Descending order
M8165=OFF Ascending order
Number of groups (m2 = K4)
Column No. 1 2 3 4
Line No. Control number Height Weight Age
Number of
data (m1 =
3)
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 m2S nD
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