Advanced Function Instruction
7-100
FUN113 D P
SORT
DATA SORTING
FUN113 D P
SORT
S : Starting register of source registers to sort
D : Starting register of destination registers to store the
data after sorted
L : Total register for sorting
TMR CTR HR IR OR SR ROR DR
K
Range
Ope-
rand
T0
∣
T255
C0
∣
C255
R0
∣
R3839
R3840
∣
R3903
R3904
∣
R3967
R3968
∣
R4167
R5000
∣
R8071
D0
∣
D4095
2
∣
127
S ○ ○ ○ ○ ○ ○ ○ ○
D ○ ○* ○
L ○ ○ ○ ○
● When sort control "EN" = 1 or "EN↑" ( P instruction) has a transition from 0 to 1, will sort the registers with
ascending order (if A/D = 1) or descending order (if A/D = 0) and put the sorted result to the registers starting
by D register.
● The valid data length of sort operation is between 2 and 127, other length will set the “ERR” to 1 and the sort
operation will not perform.
X0
EN
R 0
A/D
113DP.SORT
D :
S :
L :
R 10
10
˙
The example at left sorts the table comprised of R0~R9
and stores the sorted data to the table locate at
R10~R19.
S D
R0 1547
R10
0013
R1 2314
R11
1547
R2 7725
R12
1925
R3 0013
R13
2314
R4 5247 R14
2796
R5 1925
R15
5247
R6 6744
R16
5319
R7 5319
R17
6744
R8 9788
R18
7725
R9 2796
X0=
Ö
R19
9788
Before After