Skip to content

SQC — Sequencer Compare

Category
Shift / Sequencer
Type
Output
Availability
All platforms

SQC instruction block: File Expected, Mask 0x000F, Source Inputs_Word, Length 4, Position, with DN and FD indicators


SQC (Sequencer Compare) steps through a table of expected input patterns and reports whether the live inputs match. Each time its rung goes from false to true it advances the position, ANDs both the table element and the Source with the mask, and sets the control tag’s FD bit when the two agree. Use SQC to check that a machine’s sensors read what they should at each step of a cycle, and to raise a fault when they do not. Do not expect FD to track the inputs continuously; it is evaluated on the advance only, and holds until the next one.


Operand Type Format Valid Range Required Description
Control CONTROL tag Tag or Tag[n] One SQC 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 expected patterns; element 0 is the parked position.
Mask Whole number or tag 0x000F, Tag Any Yes Only bits set to 1 in the mask are compared.
Source INT or DINT tag, member or element Tag Any Yes The live input word.
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.

LEN is loaded from Length and POS from Position. FD is clear.

EN is cleared. Nothing advances; FD holds its last result.

On the scan the rung turns true, POS advances by one, wrapping from Length to 1, and FD is set if File[POS] AND Mask equals Source AND Mask, cleared otherwise. DN is set while POS equals Length.

Nothing.

Condition EN DN FD POS
Power-up 0 0 0 Position (usually 0)
Rung false 0 holds holds holds
False → true 1 POS = LEN masked match +1, wrapping LEN → 1
Held true 1 holds holds holds
RES on the control 0 0 0 0

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, or RES The sequencer is on its last step.
Empty .EM BOOL Never RES Not used by SQC.
Error .ER BOOL Never RES Reserved. Bad operands are refused at validation.
Unload .UL BOOL Never RES Not used by SQC.
Inhibit .IN BOOL Never RES Reserved.
Found .FD BOOL A masked match on the advance A masked mismatch on the next advance, or RES The inputs matched the table at the current step.
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.

Scenario: The indexing table from the SQO example has a sensor at each station. At each step exactly one sensor should be made, and the expected pattern table says which.

Tags:

  • Seq_Chk — Check this step, BOOL
  • Expected — Expected input table, INT[5], loaded 0, 1, 2, 4, 8
  • Inputs_Word — Live sensor word, INT
  • SQC_Ctl — Control, CONTROL, Length 4

Rung 1:

—] [Seq_Chk———[SQC SQC_Ctl Expected 0x000F Inputs_Word 4]———

Scan 1 — Seq_Chk = 0. Inputs_Word reads 1, station 1’s sensor made. Position 0, FD dark. The SQO rung above and the SQL rung below are their own pages’ examples.

Figure 1 — SQO, SQC and SQL rungs false: SQC File Expected, Mask 0x000F, Source Inputs_Word 1, Length 4, Position 0, FD dark

Scan 2 — Seq_Chk = 1. Position advances to 1; Expected[1] is 1 and the masked input is 1: FD lights.

Figure 2 — SQC rung true after one edge: Position 1, FD lit, SQC rung lit; the SQO above already at position 1

Had the sensor word read 3, FD would stay dark: a second sensor made is a mismatch. A rung XIC SQC_Ctl.EN XIO SQC_Ctl.FD → OTE Step_Fault raises the fault.


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 at validation.

Troubleshooting hints

Symptom: .FD is set although the inputs are wrong now. Likely cause: FD is evaluated on the advance only and holds until the next one. Fix: Advance the sequencer when the check should happen, or use a CMP for a continuous test.

Symptom: .FD never sets. Likely cause: The mask hides the bits that differ, or the table and the inputs use different bit positions. Fix: Compare Expected[POS] AND Mask with Source AND Mask in the Tag Browser at the failing step.


  • SQO — Sequencer Output (drive the outputs the same table describes)
  • SQL — Sequencer Load (record the expected table from a good cycle)
  • CMP — Compare by expression (a masked compare without a table)
  • Shift/Sequencer Instructions — Category index

Pair with SQO. Drive an SQO and an SQC from the same rung, on separate control tags, and the outputs and the expected inputs step together.

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

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