2 Instruction Descriptions
2-494
NJ-series Instructions Reference Manual (W502)
If the power supply is interrupted during execution of this instruction, the contents of InOut may be cor-
rupted. If you back up the contents of InOut[] each time the instruction is completed normally, you can
restore the data if it is corrupted. Refer to Sample Programming.
• Execution of this instruction is continued until processing is completed even if the value of Execute
changes to FALSE or the execution time exceeds the task period. The value of Done changes to
TRUE when processing is completed. Use this to confirm normal completion of processing.
• Refer to Using this Section on page 2-2 for a timing chart for Execute, Done, Busy, and Error.
• If Member is a real number, depending on the value of Member, the desired results may not be
achieved due to error.
• When an element in the array is passed to InOut[], all elements below the passed element are pro-
cessed.
• If the value of Size is 0, the value of Done will be TRUE and InOut[] will not change.
• An error occurs in the following cases. Done and Busy will be FALSE and Error will be TRUE.
• The value of Order is outside of the valid range.
• The value of Size exceeds the array area of InOut[].
• Member is not a member of InOut[].
• Member is not integer or real number data.
• InOut[] is not an array of structures.
In this sample, the RecSort instruction is used to sort an array Abc[] of MyStr structures in ascending
order. The member to sort is Abc[].m. To prevent loosing data even if power is interrupted during pro-
cessing, Abc[] is backed up in a variable named Abc_backup[] before sorting. If a power interruption
occurs, the contents of Abc_backup[] is restored to Abc[] and the sort operation is redone.
Definitions of Global Variables
Additional Information
Precautions for Correct Use
Sample Programming
Abc
Abc_backup
[5(l:=False, m:=0, n:=0.0)]
[5(l:=False, m:=0, n:=0.0)]
ARRAY[0..4] OF MyStr
ARRAY[0..4] OF MyStr
Global Variables
Sort array
Backup of Abc[]
MyStr
l
m
n
STRUCT
BOOL
INT
REAL
Variable
Data Types
Structure
Member
Member
Member
Data type Comment
Variable
Data type
Initial value
Retain
Comment