Sort - GE PACSystems RX7i Cpu Programmer's Reference Manual

Hide thumbs Also See for PACSystems RX7i:
Table of Contents

Advertisement

Chapter 4. Ladder Diagram (LD) Programming
4.9.8

Sort

When it receives power flow, the SORT function sorts the elements of the
memory block 'IN' in ascending order. The output memory block Q
contains integers that give the index that the sorted elements had in the
original memory block or list. Q is exactly the same size as IN. It also has a
specification (LEN) of the number of elements to be sorted.
SORT operates on memory blocks of no more than 64 elements. When EN is ON, all of the elements
of IN are sorted into ascending order, based on their data type. The array Q is also created, giving the
original position that each sorted element held in the unsorted array. OK is always set ON.
Notes: The SORT function is executed each scan it is enabled.
Do not use the SORT function in a timed or triggered input program block.
Operands
Note: For each mnemonic, use the corresponding data type for the IN and Q operands. For
example, SORT_INT requires IN and Q to be INT variables.
Parameter
Length (??)
IN
Q (must be the same type
as IN)
Example
New part numbers (%I00017 - %I00032) are
pushed onto a parts array PLIST every time
%Q00014 is ON. When the array is filled, it is
sorted and the output %Q00025 is turned on. The
array PPOSN then contains the original position
that the now-sorted elements held before the
sort was done on PLIST.
If PLIST were an array of five elements and
contained the values 25, 67, 12, 35, 14 before the
sort, then after the sort it would contain the
values 12, 14, 25, 35, 67. PPOSN would contain
the values 3, 5, 1, 4, 2.
186
PACSystems* RX7i, RX3i and RSTi-EP CPU Programmer's Reference Manual
Description
The number (1—64) of elements that make
up the memory block to sort.
The memory block that contains the
elements to sort. After the sort, IN contains
the elements in the sorted order.
An array of indexes that gives the position
of the sorted elements in the original
memory block
Mnemonics:
SORT_INT
SORT_UINT
SORT_WORD
Allowed Operands
Constants
All except data flow, S,
constants. SA – SC valid
only for WORD type
All except S - SC and
constants
Optional
No
No
No
GFK-2950C

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pacsystems rx3iPacsystems rsti-ep

Table of Contents