Skip to content

NEQ — Not Equal

Category
Compare
Type
Input (condition)
Availability
All platforms

NEQ instruction block: Source A Actual_Step and Source B Cmd_Step both reading 3, dark because they are equal


NEQ (Not Equal) is true when Source A and Source B differ. It is the inverse of EQU and, like it, a condition that writes nothing. Use NEQ to detect a mismatch: a feedback value that has not caught up with a command, a mode word that is anything but idle, a checksum that does not match. Do not use NEQ to detect a change over time; it compares two values on the same scan, not one value against its previous scan.


Operand Type Format Valid Range Required Description
Source A Any numeric tag, member, element or bit; a STRING tag; or a literal Tag, Tag.Member, Tag[n], Tag.bit, or a literal Any resolvable reference Yes The first value.
Source B Same as Source A Same Any resolvable reference; defaults to 0 Yes The value to compare against.

Literals may be whole numbers (25, -3, 0x1F), decimals (72.5), or quoted strings ("RUN"). A BOOL reads as 0 or 1. STRING operands compare by content, case-sensitively.


No state. Evaluates from the current values on the first scan.

The instruction does not pass continuity. The block still colours by its own result on the canvas.

Both operands are read. If they differ the instruction conducts; if they are equal the rung is false from this point.

Nothing.


Scenario: A stepper sequence is commanded to a step number and reports the step it is actually on. While the two differ, the sequence is in motion and a “busy” lamp is lit.

Tags:

  • Cmd_Step — Commanded step, INT
  • Actual_Step — Reported step, INT
  • Busy — Busy lamp, BOOL

Rung 1:

—[NEQ Actual_Step Cmd_Step]———(OTE Busy)———

Scan 1 — both read 3. The sequence is parked on the step it was sent to. The values match: the block is dark, the rung is false, Busy = 0. Both operands are tags, so each shows its live value beneath it.

Figure 1 — NEQ false: Actual_Step and Cmd_Step both read 3, the block dark, Busy off

Scan 2 — Actual_Step reads 0. The sequence has been reset to home while Cmd_Step still calls for step 3. 0 is not 3: the block lights, the rung is true, Busy = 1, and it stays lit until Actual_Step climbs back to 3.

Figure 2 — NEQ true: Actual_Step 0 against Cmd_Step 3, the block lit, Busy on


  • EQU — Equal (the inverse test)
  • CMP — Compare by expression
  • XIO — Examine If Open (the same idea for a single bit)
  • Compare Instructions — Category index

NEQ against zero. NEQ Word 0 is true when any bit of Word is set, a quick “anything active?” test on a status word.

REAL values. Two REALs that were computed separately will almost always be “not equal” by a rounding error. Compare REALs with LIM, or with a GRT on the absolute difference from CPT.

Not a change detector. To act once when a value changes, keep a copy with MOV and compare against the copy, or use an ONS on the NEQ result.

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