Skip to content

SQO — Sequencer Output

Category
Shift / Sequencer
Type
Output
Availability
All platforms

SQO instruction block: File Steps, Mask 0x000F, Dest Outputs, Length 4, Position, with DN indicator


SQO (Sequencer Output) steps through a table of output patterns. Each time its rung goes from false to true it advances the control tag’s position by one, reads the array element at that position, and writes it to Dest through a mask; bits where the mask is 0 are left as they were in Dest. Use SQO for a drum-sequence machine: a wash cycle, a traffic light, an indexing table whose outputs change step by step. Do not use SQO where a step must wait on a condition before advancing; the rung itself must carry that condition, and a step that should hold outputs while waiting is simply a step the rung does not advance past.


Operand Type Format Valid Range Required Description
Control CONTROL tag Tag or Tag[n] One SQO per control tag Yes Holds LEN, POS and the status bits.
File INT or DINT array tag Tag At least Length + 1 elements Yes The table of patterns. Element 0 is the start position and is never output; steps are elements 1 to Length.
Mask Whole number or tag 0x000F, 255, Tag Any Yes Bits set to 1 in the mask are written to Dest; bits at 0 are left untouched.
Dest Writable INT or DINT tag, member or element Tag Any Yes Where the step pattern is written.
Length Whole number 4 1 to array size − 1 Yes Number of steps.
Position Whole number 0 0 to Length No Starting position at power-up; 0 is the usual choice.

The array must have one more element than Length, because positions run 1 to Length and element 0 is the parked position. The validator refuses a Length that would step past the end.


LEN is loaded from Length and POS from Position. Dest is not written.

EN is cleared. Nothing advances; Dest keeps the last pattern written.

On the scan the rung turns true, POS advances by one, wrapping from Length back to 1, and File[POS] is written to Dest through the mask. DN is set while POS equals Length and clear otherwise. Holding the rung true does nothing more.

Nothing.

Condition EN DN POS Dest
Power-up 0 0 Position (usually 0) holds
Rung false 0 holds holds holds
False → true 1 POS = LEN +1, wrapping LEN → 1 (File[POS] & Mask) | (Dest & ~Mask)
Held true 1 holds holds holds
RES on the control 0 0 0 holds

Bit Mnemonic Data type Set by Cleared by Operation description
Enable .EN BOOL The rung being true The rung being false, or RES Mirrors the rung condition.
Enable unload .EU BOOL Never RES Reserved.
Done .DN BOOL POS reaching LEN The next advance (wrap to 1), or RES The sequencer is on its last step. Use it to run an end-of-cycle action or to reset.
Empty .EM BOOL Never RES Not used by SQO.
Error .ER BOOL Never RES Reserved. A Length that overruns the array is refused at validation.
Unload .UL BOOL Never RES Not used by SQO.
Inhibit .IN BOOL Never RES Reserved.
Found .FD BOOL Never RES Not used by SQO.
Length .LEN INT Length at power-up Never (RES preserves it) Number of steps.
Position .POS INT Each advance RES (to 0) The current step; 0 means parked before the first step.

Scenario: A four-station indexing table energises one output per station. The pattern table holds one bit per step, and the four low bits of Outputs drive the stations.

Tags:

  • Seq_Step — Index complete, BOOL
  • Steps — Pattern table, INT[5], loaded 0, 1, 2, 4, 8
  • Outputs — Station outputs, INT
  • SQO_Ctl — Control, CONTROL, Length 4

Rung 1:

—] [Seq_Step———[SQO SQO_Ctl Steps 0x000F Outputs 4]———

Scan 1 — Seq_Step = 0. Position 0, nothing has been output: Outputs reads 0 and DN is dark. The SQC and SQL rungs below are the examples from their own pages, parked. A File operand lists the array’s values, trimmed in the middle when it is long.

Figure 1 — SQO, SQC and SQL rungs false: SQO File Steps, Mask 0x000F, Dest Outputs 0, Length 4, Position 0

Scan 2 — Seq_Step = 1. Position advances to 1 and Steps[1] is written: Outputs reads 1, station 1 on.

Figure 2 — SQO rung true after one edge: Outputs 1, Position 1, SQO rung lit; SQC and SQL still parked

Three more edges write 2, 4 and 8; on the fourth DN lights. The next edge wraps to position 1 and writes 1 again.


Error definitions

.ER cause Condition that sets it .POS / status value Meaning
None .ER is never set by LadderIDE — A File that is not an INT/DINT array, or a Length of array size or more, is refused when the project is validated.

Troubleshooting hints

Symptom: The first edge outputs step 1, not step 0. Likely cause: Position 0 is the parked start; the first advance goes to 1. Fix: Put the first real pattern in element 1. Element 0 is never output.

Symptom: Bits outside the sequence change unexpectedly. Likely cause: The mask covers bits other rungs also write, or the mask is wider than intended. Fix: Narrow the mask to exactly the bits the sequencer owns; other rungs may then drive the rest of Dest.

Symptom: The sequencer restarts at step 1 after a power cycle. Likely cause: POS is not retained; it is loaded from Position at power-up. Fix: That is the intended behaviour. A cycle that must resume needs its own step memory.


  • SQC — Sequencer Compare (check inputs against a table)
  • SQL — Sequencer Load (teach the table from live values)
  • RES — Reset (park at position 0)
  • AND — Bitwise AND (the same masking on its own)
  • Shift/Sequencer Instructions — Category index

Timed steps. Drive the rung from a TON’s DN with the timer reset on each step; the sequencer advances once per timeout.

Dwell on a step. The outputs hold while the rung stays false, so a step that waits on a sensor is a rung condition, not a special step.

The block colours neutral. Watch the rung wire, the Position row and DN.

Applies to LadderIDE >=1.2.2 · Last reviewed 2026-09-11 · Screenshots verified 2026-09-11