SQC — Sequencer Compare

Description
Section titled “Description”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.
Operands
Section titled “Operands”| 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. |
Scan Behavior
Section titled “Scan Behavior”Prescan
Section titled “Prescan”LEN is loaded from Length and POS from Position. FD is clear.
Rung-condition-in is false
Section titled “Rung-condition-in is false”EN is cleared. Nothing advances; FD holds its last result.
Rung-condition-in is true
Section titled “Rung-condition-in is true”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.
Postscan
Section titled “Postscan”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 |
Member Bits
Section titled “Member Bits”| 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. |
Example
Section titled “Example”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, BOOLExpected— Expected input table, INT[5], loaded 0, 1, 2, 4, 8Inputs_Word— Live sensor word, INTSQC_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.

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

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.
Control Tag Errors and Troubleshooting
Section titled “Control Tag Errors and Troubleshooting”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:
.FDis 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:
.FDnever sets. Likely cause: The mask hides the bits that differ, or the table and the inputs use different bit positions. Fix: CompareExpected[POS] AND MaskwithSource AND Maskin the Tag Browser at the failing step.
See Also
Section titled “See Also”- 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