Sequencer Load (SQL)

The SQL instruction loads the source operand value into the sequencer array.
When .EN transitions from false to true, the .POS is incremented. The .POS is reset to 1 when the .POS becomes > or = to .LEN. The SQL instruction loads the Source value into the Array at the new position.
When .EN is true the SQL instruction loads the Source value into the Array at the current position.
Typically use the same CONTROL structure as the SQI and SQO instructions.
IMPORTANT
You must test and confirm that the instruction does not change data that you don’t want it to change.
Available Languages
Ladder Diagram
FBD Function_Sequencer Load (SQL)_v1
Operands
The data conversion rules for mixed data types within an instruction. See Data Conversion.
Operand
Type
Format
Description
Array
DINT
array tag
Sequencer array
Specify the first element of the sequencer array
do not use CONTROL.POS in the subscript
Source
SINT
INT
DINT
tag
immediate
Data to load into the sequencer array at a location specified by .POS.
Control
CONTROL
tag
Control structure for the operation
The same control tag should be used in the SQI and SQO instructions
Length
DINT
immediate
This represents the CONTROL structure .LEN.
Position
DINT
immediate
This represents the CONTROL structure .POS.
CONTROL Structure
Mnemonic
Data Type
Description
.EN (Enable)
BOOL
The enable bit indicates the SQL instruction is enabled.
.DN (Done)
BOOL
The done bit is set when all the specified elements have been loaded into Array.
.ER (Error)
BOOL
The error bit is set when .LEN < or = to 0, .POS < 0, or .POS > .LEN.
.LEN (Length)
DINT
The length specifies the number of sequencer steps in the sequencer array.
.POS (Position)
DINT
The position identifies where in the Array the Source value will be stored.
Affects Math Status Flags
No
Major/Minor Faults
A major fault will occur if:
Fault Type
Fault Code
position > size of Array
4
20
Execution
Condition/State
Action Taken
Prescan
The .EN is set to true.
Rung-condition-in is false
The .EN is cleared to false
Rung-condition-in is true
See Flow Chart (True)
Postscan
N/A
Flow Chart - True
SQL Flow Chart True
Example
Ladder Diagram
FTStudio-SQL-LD-EX-V1
When enabled, the SQL instruction loads value_3 into the next position in the sequencer array, which is array_dint[5] in this example.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.