Table of Contents
TogglePLC compare instructions test a condition between two values and return true or false. A PLC compare instruction is one of the most frequently used building blocks in Ladder Logic.
Every alarm setpoint, every process limit, and every conditional output uses a PLC compare instruction to make its decision.
This guide covers EQU, NEQ, LES, and GRT with ladder rung examples, a worked application, and a live compare instruction simulator.
A PLC compare instruction acts like a contact in the rung. It passes power when its condition is true and blocks when false. The difference is that a PLC compare instruction compares numbers, not bit states.
PLC Compare Instructions: What They Do and Why They Matter

Each PLC compare instruction sits on a rung exactly like a contact. When the comparison is true, power flows through it. When it is false, power is blocked -- just as a normally open contact blocks power when the bit is off.
The four core PLC compare instructions are EQU (Equal), NEQ (Not Equal), LES (Less Than), and GRT (Greater Than). Click any term to expand its definition.
The 4 PLC Compare Instructions with Rung Examples
EQU -- Equal To
EQU passes power when Source A and Source B are exactly equal. It is most reliable with integer data types (INT, DINT).
With REAL registers, floating point rounding means two values may differ by a tiny amount. Use a tolerance band (GRT and LES together) instead of EQU for floating point comparisons.
Practical use: checking a counter has reached its preset, verifying a recipe step number, confirming a position matches a home setpoint. Used alongside PLC counter instructions for end of count actions.
NEQ -- Not Equal To
NEQ is the logical opposite PLC compare instruction to EQU. It passes power whenever the two values are different. It is true for every possible value except the one case where A equals B.
The most important use of NEQ is guarding a DIV rung against division by zero. An NEQ 0 contact before the DIV instruction prevents a PLC major fault.
See PLC memory addressing for how to structure intermediate registers.
Practical use: division by zero protection, detecting when a value has changed from its previous scan (by comparing to a shadow register), keeping a process running while a condition is not yet satisfied.
LES -- Less Than
LES passes power when Source A is strictly less than Source B. Strictly means exactly less than -- if A equals B, LES is false. For a less than-or-equal comparison, use the LEQ instruction instead.
Source A is the value being tested. Source B is the limit or threshold.
Getting the order backwards gives opposite logic -- a common mistake on first use. Think of it as reading left to right: Source A is less than Source B.
Practical use: low pressure alarm, low temperature cutout, minimum speed check, confirming a register has not yet reached its target. Also used in pairs with GRT to create a tolerance band around a setpoint -- a technique used in simple bang bang temperature control.
GRT -- Greater Than
GRT passes power when Source A is strictly greater than Source B. It is the mirror of LES. For a greater than-or-equal comparison, use GEQ instead.
GRT is the workhorse PLC compare instruction for high limit alarms. Every high temperature alarm, high pressure trip, and maximum speed limit in a PLC program uses a GRT or GEQ rung to detect when the process variable has exceeded the setpoint.
Practical use: high temperature alarm, overpressure trip, high level alarm, motor overcurrent detection, maximum batch weight check.
In safety applications, GRT feeds directly into a safety relay or SIL rated output module. See PLC timer instructions for adding a TON delay before the GRT output latches.
PLC Compare Instruction Simulator
All 6 PLC Compare Instructions: Quick Reference
| Instruction | True When | False When | Common Use |
|---|---|---|---|
| EQU | A = B | A not equal B | Counter target reached, recipe step match |
| NEQ | A not equal B | A = B | Division by zero guard, change detection |
| LES | A strictly less than B | A greater than or equal to B | Low limit alarm, fill logic |
| GRT | A strictly greater than B | A less than or equal to B | High limit alarm, overpressure trip |
| LEQ | A less than or equal to B | A greater than B | Fill complete (reach or exceed target level) |
| GEQ | A greater than or equal to B | A less than B | Minimum speed confirmed, start permissive |
Real-World Applications Using PLC Compare Instructions
Temperature Alarm and Control
GRT checks if temperature exceeds the high alarm setpoint. LES checks if it falls below the low alarm.
A tolerance band using both creates simple on off control: heater on when LES lower limit, heater off when GRT upper limit.
Batch Counter Target
EQU compares a batch counter to the target count. When the two are equal, the batch complete bit sets. Used directly with CTU counter instructions -- the counter accumulated value (ACC) is Source A, the preset (PRE) is Source B.
Alarm Delay with Timer
A GRT rung enables a TON timer. The timer output (DN bit) triggers the alarm. This prevents nuisance alarms from momentary spikes. The GRT detect the exceedance; the TON timer holds the condition for a defined period before latching the alarm.
Scaled Signal Quality Check
After scaling a raw ADC count, a PLC compare instruction verifies the result is within the valid engineering range.
A reading below 4 mA equivalent (LES lower limit) or above 20 mA equivalent (GRT upper limit) flags a sensor fault. See shift register patterns.
Watch: PLC Compare Instructions LES, GRT, EQU, NEQ Explained
PLC Compare Instructions Questions
External References
- PLC Comparison Instructions Explained -- Control.com
- Comparison Instructions in PLC Programming -- InstrumentationTools
What We Learn Today
- A PLC compare instruction acts like a contact -- true passes power, false blocks it
- EQU: true when A = B. Use with INT/DINT; avoid for REAL values (use a tolerance band instead)
- NEQ: true when A not equal B. Essential as a division by zero guard before any DIV rung
- LES: true when A strictly less than B. Used for low limit alarms and fill to-level logic
- GRT: true when A strictly greater than B. Used for high limit alarms and overpressure trips
- Source A must be a register address. Source B can be a register or an immediate constant
