The Sort File instruction is a ladder logic rung instruction that sorts data in an array into ascending order. The instruction is enabled when the preceding logic is true and disabled otherwise.
The Sort File instruction uses the Control data type to sort the data.
Insure the Length and Position does not travel outside the array boundaries.
List of possible arguments
ARRAY TAG & DIMENSION TO VARY must be an array and the dimension of the array must be pointed out.
ARRAY can be one of the following data types
- DIM TO VARY Must be a Constant with one of these values 0,1,2
- CONTROL Must be a Control Data Type
- LENGTH The amount of elements in the array to average
- POSITION Is the beginning position in the array to average
If the Position or Length is less than zero a major fault will occur. Make sure the length is less than or equal to the actual array size. If the Length value is set higher than the length of the array the destination value will be wrong.
Note: Arithmetic status flags are affected (S:V, S:Z, S:N, S:C). Overflow, Zero, Negative, and Carry.