PLC Sequencer Instruction: SQO, SQI, and SQL Explained
PLC sequencer instructions explained — how SQO/SQI/SQL step through a data table, when to use a sequencer vs individual rungs, and a ladder example.
A PLC sequencer instruction lets you drive a machine through a fixed series of steps — each step sets a defined output pattern — without writing a separate rung for every combination. Instead of dozens of interlocked coils, you load a data table, define a mask, and advance a position pointer one step at a time. The PLC reads the current row of the table and drives outputs (or evaluates inputs) exactly as programmed.
This tutorial covers how Allen-Bradley SQO, SQI, and SQL instructions work, walks through a complete ladder example, and explains when a sequencer is the right tool versus other approaches.
What Is a Sequencer in a PLC?
The simplest way to picture a PLC sequencer is a drum controller — the electromechanical cam drum used in washing machines and dishwashers before PLCs existed. A physical drum had pegs arranged in rows around its circumference. As the drum rotated one step, each peg either closed or opened a set of output contacts, producing a unique output pattern for that position. The next rotation step produced the next pattern.
A PLC sequencer replaces the physical drum with a data table in memory. Each row in the table (called a step or position) contains a word of bit data representing the desired output state for that step. A position counter keeps track of which row is active. When a transition event occurs — typically a timer expiring or a pushbutton press — the counter increments and the instruction copies the next row of the table to the outputs.
Key terms you need before continuing:
| Term | What it means |
|---|---|
| File / Array | The integer file or integer array holding all step data |
| Mask | A word that filters which bits in the data table actually affect the outputs |
| Position | The current step number (pointer into the data table) |
| Length | Total number of steps in the sequence |
| Destination | The output word (or input comparison word) the instruction writes to |
Allen-Bradley Logix5000 (Studio 5000) and PLC-5/SLC 500 use three sequencer instructions: SQO (Sequencer Output), SQI (Sequencer Input), and SQL (Sequencer Load). Each serves a distinct role in a complete sequencer application.
SQO — Sequencer Output
SQO is the workhorse instruction. On each false-to-true transition of its enable rung, it increments the position counter and copies the corresponding row of the data table — after masking — to the destination output word.
SQO Parameters
SQO Sequencer Output
File #N7:0 (data table, e.g. N7:0 through N7:5 for 6 steps)
Mask 0000_1111_1111_1111b (or a hex constant, e.g. 0FFFh)
Dest O:2 (output word driven by the sequencer)
Control R6:0 (control element: .EN, .DN, .ER bits + .POS, .LEN)
Length 6 (number of steps)
Position 0 (auto-managed by the instruction)
How the mask works. The mask is a word-length bitmask. Any bit set to 1 in the mask is passed through — the corresponding bit in the data table row is written to the destination. Any bit set to 0 in the mask is blocked — that bit in the destination is left unchanged. This lets you share an output word between a sequencer and other rungs without the sequencer overwriting bits it does not own.
Transition event. SQO advances one step per false-to-true transition of the rung condition. The most common transition source is a one-shot (ONS) instruction driven by a timer done bit, a pushbutton, or a sensor. Using a plain timer DN bit without a one-shot causes the position to advance on every scan while the bit is true, which is almost never the intent. See the PLC timer programming guide for how to pair TON timers with ONS contacts for reliable step transitions.
DN bit. When the position reaches the Length value, the .DN bit sets and the position wraps back to 1 (not 0 — position 0 is the reset/home position, unused during normal sequencing). To repeat the cycle, keep enabling the rung. To stop at the last step, use the .DN bit to inhibit the transition rung.
SQI — Sequencer Input
SQI does not drive outputs. Instead, it compares a source word against a row of the data table using the same mask logic. The instruction sets its rung output (the SQI bit) true only when the masked source word matches the masked data table row at the current position.
Where SQI Fits
SQI is typically used alongside SQO to verify that inputs match the expected state before advancing to the next step. For example:
- SQO step 3 turns on a clamp solenoid.
- An SQI rung at position 3 compares a limit-switch input word against the expected "clamped" pattern.
- Only when the SQI bit goes true (inputs confirmed) does the transition event fire the SQO to advance to step 4.
This creates an interlocked sequence: the machine waits for real-world confirmation before moving on, rather than blindly advancing on a timer alone.
SQI Sequencer Input
File #N7:20 (separate data table with expected input patterns)
Mask 00FFh (only check lower 8 bits)
Source I:1 (input word being verified)
Control R6:2 (shares .POS with the paired SQO via same control block)
Length 6
Position 0
Important: SQI does not advance the position counter itself. The position is read-only for SQI. Position management belongs entirely to SQO (or SQL). If you need SQO and SQI to stay in sync, the common approach is to give them the same Control element (e.g., R6:0), which means they share a position pointer.
SQL — Sequencer Load
SQL loads a live word of data from a source into the data table at the current position. It is used for two main purposes:
- Teaching a sequence — during commissioning, you jog the machine to each step position manually, then trigger SQL to capture the current output or input word into that row. This "teach mode" eliminates hand-calculating bit patterns.
- Updating a step dynamically at runtime — less common, but possible if step patterns need to change based on a recipe or operator input.
SQL Sequencer Load
File #N7:0
Source O:2 (capture current output state into data table)
Control R6:0
Length 6
Position 0
SQL also steps the position on each false-to-true transition, just like SQO. During a teach sequence, you would step through each position, set the physical outputs to the desired state, then trigger SQL to store them — building the table one row at a time.
How the Data Table, Mask, and Position Work Together
To make this concrete, imagine a three-output system (outputs on O:2 bits 0–2): a conveyor motor (bit 0), a fill valve (bit 1), and a discharge valve (bit 2). A six-step sequence might look like this:
| Position | Bit 2 (Discharge) | Bit 1 (Fill) | Bit 0 (Conveyor) | Word value (decimal) |
|---|---|---|---|---|
| 1 — Home/idle | 0 | 0 | 0 | 0 |
| 2 — Convey to fill | 0 | 0 | 1 | 1 |
| 3 — Stop, open fill | 0 | 1 | 0 | 2 |
| 4 — Close fill, wait | 0 | 0 | 0 | 0 |
| 5 — Convey to discharge | 0 | 0 | 1 | 1 |
| 6 — Open discharge | 1 | 0 | 0 | 4 |
With a mask of 0007h (binary 0000 0000 0000 0111), only bits 0–2 are passed through. Other bits in O:2 used by other rungs are unaffected.
The data file #N7:0 stores these six integer values: [0, 1, 2, 0, 1, 4]. At position 3 the SQO writes 2 through the mask to O:2, turning on only the fill valve.
A Ladder Logic Example: Traffic Light Sequencer
A traffic light cycling through Green → Yellow → Red is a clean, visual sequencer example. Outputs: Green (O:3/0), Yellow (O:3/1), Red (O:3/2). A TON timer drives the step advance.
Data table #N7:10 (three steps, mask 0007h):
| Position | Red | Yellow | Green | Word |
|---|---|---|---|---|
| 1 | 0 | 0 | 1 | 1 |
| 2 | 0 | 1 | 0 | 2 |
| 3 | 1 | 0 | 0 | 4 |
Rung 1 — Timer (TON):
|--[Run_Switch]--------------------------------[TON Timer:T4:0]--|
| Preset 5000 |
| Accum 0 |
The timer runs as long as Run_Switch is on. When it reaches 5000 ms (5 s) the .DN bit sets for one scan.
Rung 2 — One-shot to advance sequencer:
|--[T4:0/DN]--[ONS:B3:0/0]---[SQO File:#N7:10 Mask:0007h Dest:O:3 Control:R6:10 Length:3]--|
The ONS bit ensures SQO fires exactly once per timer cycle — not on every scan while .DN is true. After SQO fires, O:3 holds the new output pattern.
Rung 3 — Reset timer:
|--[T4:0/DN]--------------------------------------[RES T4:0]--|
Resetting the timer restarts the 5-second count, creating a continuous loop. Each cycle: timer counts → .DN fires → ONS triggers SQO → SQO advances position → O:3 updates → timer resets.
Rung 4 — Stop at end (optional):
|--[R6:10/DN]-----[OTL Run_Switch_latch]--| (or branch to alarm rung)
The .DN bit after position 3 can stop the cycle or can be ignored if you want continuous looping (position wraps back to 1 automatically).
This mirrors the approach used in the practical PLC programming examples guide, which covers several cyclic output patterns.
Sequencer vs Individual Rungs vs State Machine
Three common approaches exist for stepped sequences. Each has a natural home.
Individual Rungs
You write one rung per step, each with an interlocked combination of contacts that energizes a set of coils. A step-number internal bit (B3:0/0, B3:0/1, etc.) gates each rung.
Use individual rungs when:
- The sequence has fewer than 4–5 steps with many conditional branches per step
- Each step requires unique timer presets or complex logic that does not fit neatly into a bit pattern
- You need different dwell times per step (sequencer uses a single advance event per step)
Drawback: A 20-step sequence with 8 outputs per step requires 160 individual coil/contact combinations. Adding a step means inserting rungs and re-numbering step bits. This is the scenario sequencer instructions were designed to replace.
PLC Sequencer Instructions (SQO/SQI/SQL)
Use a sequencer when:
- The sequence has 6 or more steps with the same outputs repeated or varied across steps
- All steps share the same dwell event (timer advance, pushbutton, cycle complete)
- You want to be able to adjust a step pattern by editing one integer in a data table, not hunting through rungs
- Commissioning is faster via SQL "teach mode" than computing bit patterns by hand
Drawback: All steps use the same transition event — you cannot give step 3 a 10-second timer and step 5 a 2-second timer without additional logic around the timer preset. Conditional branching (go to step 7 if sensor X is active, else go to step 4) requires extra rungs to manipulate the .POS integer directly.
State Machine (SFC or Structured Rung Logic)
Sequential Function Chart (SFC) or a software state machine implemented in structured text or ladder gives you full conditional branching, variable dwell times, and parallel branches. This is the modern replacement for sequencer instructions in complex applications.
Use a state machine when:
- Different steps need different timers or multiple simultaneous conditions to advance
- The sequence can branch (reject path vs. accept path)
- You need parallel sequences running simultaneously
- The application will be maintained by engineers unfamiliar with legacy SQO syntax
For an introduction to counting steps and tracking cycles across any of these approaches, the PLC counter programming guide explains CTU/CTD counters that are often used alongside sequencer position logic. The ladder logic tutorial covers the foundational rung structure these examples build on.
Modern Alternatives to SQO/SQI/SQL
Allen-Bradley SQO/SQI/SQL instructions are primarily a SLC 500 and PLC-5 era feature. In Studio 5000 (Logix5000) they still exist for backward compatibility, but most modern AB projects use one of these alternatives:
Structured Text CASE statement. A CASE statement on a step-number integer variable is more readable for modern engineers and trivially supports variable timers per step:
CASE Step OF
1: ConveyorMotor := TRUE; FillValve := FALSE; DischargeValve := FALSE;
2: ConveyorMotor := FALSE; FillValve := TRUE; DischargeValve := FALSE;
3: ConveyorMotor := FALSE; FillValve := FALSE; DischargeValve := TRUE;
END_CASE;
Transition logic lives in separate IF blocks, keeping step actions and advance conditions cleanly separated.
Sequential Function Chart (SFC). SFC is IEC 61131-3 standard and is native in Studio 5000. Each step is a graphical block; transitions are boolean expressions between steps. SFC is the first choice for new sequences with more than 8–10 steps or any conditional branching.
Shift register approach. For conveyor tracking — where a product bit needs to follow a part as it moves through zones — a shift register is more appropriate than a positional sequencer. A shift register advances a bit through an array on each conveyor pulse rather than driving outputs from a lookup table.
Despite these alternatives, SQO/SQI/SQL remain common in legacy maintenance work. Understanding them is essential for any technician reading SLC 500 or PLC-5 code, and the concept transfers directly to custom sequencer patterns in any PLC brand.
Frequently Asked Questions
What is a sequencer in a PLC? A PLC sequencer is an instruction that steps through a data table one row at a time, copying each row's bit pattern to an output word (or comparing it to an input word). Each step represents one stage in a machine cycle. It is the software equivalent of a mechanical drum controller.
What is the SQO instruction? SQO (Sequencer Output) is an Allen-Bradley instruction that, on each false-to-true rung transition, increments a position counter and writes the corresponding row of the data table through a mask to a destination output word. It drives outputs in a predetermined sequence without requiring a separate rung for each step combination.
What is a mask in a sequencer?
The mask is a word-length bitmask. Bits set to 1 in the mask allow the corresponding data table bits to pass through to the destination. Bits set to 0 block that bit position, leaving the destination bit unchanged. This lets a sequencer share an output word with other program logic without conflict.
When should you use a sequencer instruction? Use a sequencer when you have six or more steps, all steps share the same advance event (a timer or a pushbutton), and the output pattern per step can be expressed as a fixed bit word. For sequences with variable dwell times per step, conditional branching, or parallel paths, a state machine or SFC is a better fit.
How does SQI differ from SQO? SQO writes data from the table to an output; SQI reads a live input word and compares it to a data table row. SQI's rung output bit goes true only when the masked input matches the expected pattern for the current position. It is used to confirm real-world conditions before allowing the sequence to advance.


