Bin 16 Bit-Data Sort Operations; Bin 32 Bit-Data Sort Operations - Mitsubishi MELSEC-Q/L Programming Manual

Table of Contents

Advertisement

7.5.12
SORT

BIN 16 bit-data sort operations

7.5.12
DSORT

BIN 32 bit-data sort operations

SORT, DSORT
SORT, DSORT
: Head device number in the table to be sorted (BIN 16/32 bits)
S1
n
: Number of data blocks to be sorted (BIN 16 bits)
: Number of data blocks to be compared in one sort operation (BIN 16 bits)
S2
: Number of the bit device to be turned ON at the completion of the sort operation (bits)
D1
: Device reserved for the system (BIN 16 bits)
D2
Setting
Internal Devices
Data
Bit
––
S1
n
S2
D1
––
D2
Function
SORT
(1) Sorts (rearranges data) BIN 16-bit data n points from
Sort order is designated by the ON/OFF status of SM703:
• When SM703 is OFF: Ascending order sort
• When SM703 is ON : Descending order sort
Data before sort
S
35
S
+1
-10
S
+2
500
-124
S
+3
(2) Several scans are required for sorts performed by the SORT instruction. The number of scans executed until completion
is the value obtained by dividing the maximum number of times executed until the completion of the sort by the number
of data blocks compared at one execution designated by
increased, the number of scans until completion of the sort is reduced, but the amount of time per scan is lengthened.
(3) The maximum number of executions until completion of the sort should be calculated according to the following
equation:
The maximum number of executions until completion
Example
When n 10, the number of executions is obtained as 10
of scans until the completion of sort is calculated as 45/2 22.5
(4) The device designated by
ON when the sort is completed. Because the device designated by
of the sort, the user must turn it OFF if required.
Command
R, ZR
Word
Bit
––
S
S
+1
When SM703 = OFF
S
+2
S
+3
S
S
+1
S
+2
When SM703 = ON
S
+3
(the completion device) is turned OFF by the execution of the SORT instruction, and turned
D1
High
Basic
performance
indicates an instruction symbol of SORT/DSORT.
n
S 1
S2
J
\
U
\G
Word
––
––
––
in ascending or descending order.
S1
-124
-10
Sort in the ascending order
35
500
500
35
Sort in the descending order
-10
-124
. (Decimal fractions are rounded up.) When the value of
S2
(n)
(n - 1) / 2 [times executed]
(10 - 1) / 2 45 [times executed]. If
23 [scans].
is maintained in the ON state after the completion
D1
SORT, DSORT
Process
Redundant Universal
LCPU
D1
D2
Constants
Zn
Other
K, H
––
––
––
––
––
2, then the number
S2
1
2
3
4
4
6
7
8
is
S2
375

Advertisement

Table of Contents
loading

Table of Contents