Try a PLC free — no signup
Comparison OperationsBeginnerIEC 61131-3

EQ (Equal)

Returns TRUE when both inputs are exactly equal.

The EQ (Equal) comparison function returns TRUE when the first input is exactly equal to the second input. It is used for exact match comparisons in PLC programs, such as recipe selection by number, state machine step comparisons, and discrete setpoint matching. When comparing REAL (floating-point) values, it is generally recommended to use a tolerance band (value within range) rather than exact equality due to floating-point precision limitations.

Parameters

Inputs

NameTypeDescription
IN1ANYFirst value
IN2ANYSecond value

Outputs

NameTypeDescription
OUTBOOLTRUE when IN1 = IN2

Ladder Logic Example

// Ladder Logic - EQ Comparison (Step Selection)
//
// |----[EQ]---( Step_3_Active )----|
// | IN1: Current_Step               |
// | IN2: 3                          |

Structured Text Example

IF Current_Step = 3 THEN
    Step_3_Active := TRUE;
    // Execute step 3 actions
END_IF;

Free · no signup to try

Run this block in your browser

Try the instruction on a live rung before you copy it into a project — nothing to install.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use CMP == instruction in TIA Portal.

AB

Allen-Bradley (Studio 5000)

Use EQU (Equal) instruction.

C

CODESYS

Use = operator in ST or EQ function block.

Common Applications

  • State machine step comparisons
  • Recipe number matching
  • Mode selection
  • Error code identification
  • Batch number verification

Frequently Asked Questions

What is EQ (Equal) in PLC programming?

Returns TRUE when both inputs are exactly equal. The EQ (Equal) comparison function returns TRUE when the first input is exactly equal to the second input. It is used for exact match comparisons in PLC programs, such as recipe selection by number, state machine step comparisons, and discrete setpoint matching.

What are common applications of EQ (Equal)?

EQ (Equal) is commonly used for: State machine step comparisons, Recipe number matching, Mode selection, Error code identification, Batch number verification.

How do I use EQ (Equal) in different PLC platforms?

Siemens: Use CMP == instruction in TIA Portal. Allen-Bradley: Use EQU (Equal) instruction. CODESYS: Use = operator in ST or EQ function block.

Free · no signup to try

Wire this block up and run it

Drop the instruction into a rung, press Run and watch it execute in your browser — then adapt it to your vendor tool.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad