AH500 Programming Manual 
6-270 
API 
Instruction code
Operand  Function 
1205  D  SORT   
S, m
1
, m
2
, D, n 
Sorting the data 
Device
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#
“$”  DF 
  Pulse instruction
16-bit instruction (11 steps)
32-bit instruction (11 steps) 
  -  AH500  AH500 
Symbol: 
S 
:
Initial device in which the original 
data is stored 
Word/Double word 
m
1
:
Number of rows of data  Word/Double word 
m
2
:
Number of columns of data  Word/Double word 
D 
:
Initial device in which the sorted 
data is stored 
Word/Double word 
n 
:
Reference value involved in the 
sorting of the data 
Word/Double word 
Explanation: 
1.  The data which is sorted is stored in the m1×m2 registers starting from the register specified 
by D. If S and D specify the same register, the sorted data is the same as the original data in 
the register specified by S.   
2.  The operand m
1
 should be within the range between 1 and 32. The operand m
2
 should be 
within the range between 1 and 6. The operand n should be within the range between 1 and 
m
2
. 
3.  When SM604 is OFF, the data is sorted in ascending order. When SM604 is ON, the data is 
sorted in descending order.   
4.  Only the 32-bit instruction can use the 32-bit counter. 
 
Example: 
1.  Suppose SM604 is OFF. When X0.0 is switched from OFF to ON, the data is sorted in 
ascending order.