DVP-ES2/EX2/EC5/SS2/SA2/SX2/SE&TP Operation Manual - Programming
-214
API
Mnemonic Operands Function
69 D SORT
Data sort
Type
OP
Bit Devices Word devices Program Steps
X Y M S K H KnX
KnY
KnM
KnS
T C D E F
SORT: 11 steps
DSORT: 21 steps
SS2
SX2
SS2
SX2
SS2
SX2
Operands:
S: Start device for the source data m
1
: Groups of data to be sorted (m
1
=1~32) m
2
: Number of
columns in the table (m
2
=1~6) D: Start device for the sorted data n: The No. of column to be
sorted. (n=1~ m2)
Explanations:
1. The sorted data is stored in the m
1
× m
2
registers starting from the device designated in D.
Therefore, if S and D designate the same register, the sorted results will be the same.
2. It is better that the rightmost number of the device number of the register specified by S is 0.
3. SORT instruction is completed after m
1
times of scan. Once the SORT instruction is completed,
the Flag M1029 (Execution completed flag) = ON.
4. There is no limitation on the times of using this instruction in the program. However, only one
instruction can be executed at a time
5. The function of sorting one-dimensional data is added. If m
1
is 1, and m
2
is 1, the function will be
enabled, and the operand n represents the number of data (n=1~32). The data in n devices
starting from the operand S are sorted. The sort result is stored in the devices starting from the
operand D. It takes one scan cycle for the data to be sorted. After the data is sorted, M1029 will
be On. This function supports SS2 V3.0/SA2 V2.6/SX2 V2.4/ES2/EX2/ES2-C V3.2.
Program Example:
When X0 = ON, the sorting process starts. When the sorting is completed, M1029 will be ON. DO
NOT change the data to be sorted during the execution of the instruction. If the sorting needs to be
executed again, turn X0 from OFF to ON again.