beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 341

background image

7 Application Instructions API 50-99

D V P - P L C A P P L I C AT I O N M A N U A L

7-57

API Mnemonic

Operands

Function

69

SORT

Sort Tabulated Data

Controllers

ES/EX/SS SA/SX/SC EH/SV

Bit Devices

Word Devices

Program Steps

Type

OP

X Y M S K H

KnX KnY KnM KnS T

C

D

E

F

S

*

m

1

*

*

m

2

*

*

D

*

n

*

*

*

SORT: 11 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

: Start device for the original data m

1

: Groups of data to be sorted m

2

: Number of columns of data

D

: Start device for the sorted data n: Reference value for data sorting

Explanations:

1. Range

of

m

1

: 1 ~ 32.

2. Range

of

m

2

: 1 ~ 6

3. Range

of

n

: 1 ~ m

2

4. See the specifications of each model for their range of use.

5. Flag: M1029 (SORT execution completed).

6. The sorted result is stored in m1 × m2 registers starting from the device designated in D. Therefore, if S and D

designate the same register, the sorted result will be the same as the data designated in S.

7. It is better that the start No. designated in S is 0.

8. The sorting will be completed after m

1

times of scans. After the sorting is completed, M1029 will be On.

9. There is no limitation on the times of using this instruction. However, only one instruction can be executed at a

time.

Program Example:

1. When X0 = On, the sorting will start. When the sorting is completed, M1029 will be On. DO NOT change the data

to be sorted during the execution of the instruction. If you wish to change the data, please make X0 go from Off to

On again.

X0

SORT

D0

K5

K5

D50

D100

2. Example table of data sorting