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
| Name | Type | Description |
|---|---|---|
| IN1 | ANY | First value |
| IN2 | ANY | Second value |
Outputs
| Name | Type | Description |
|---|---|---|
| OUT | BOOL | TRUE 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;20 Production-Ready Ladder Logic Templates
Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.
Platform-Specific Implementation
Siemens (TIA Portal)
Use CMP == instruction in TIA Portal.
Allen-Bradley (Studio 5000)
Use EQU (Equal) instruction.
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.
Related Function Blocks
NE (Not Equal)
Returns TRUE when inputs are not equal to each other.
View Reference →GT (Greater Than)
Returns TRUE when first input is strictly greater than second input.
View Reference →LT (Less Than)
Returns TRUE when first input is strictly less than second input.
View Reference →GE (Greater Than or Equal)
Returns TRUE when first input is greater than or equal to second input.
View Reference →LE (Less Than or Equal)
Returns TRUE when first input is less than or equal to second input.
View Reference →Stop Writing Ladder Logic From Scratch
Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.
Instant download - 30-day money-back guarantee - Use on unlimited projects