Learn PLCs free
Comparison OperationsBeginnerIEC 61131-3

NE (Not Equal)

Returns TRUE when inputs are not equal to each other.

The NE (Not Equal) comparison function returns TRUE when the two inputs are not equal to each other. It is the logical complement of EQ. NE is used for detecting changes in value, error conditions, and any situation where inequality indicates a required action.

Parameters

Inputs

NameTypeDescription
IN1ANYFirst value
IN2ANYSecond value

Outputs

NameTypeDescription
OUTBOOLTRUE when IN1 <> IN2

Ladder Logic Example

// Ladder Logic - NE Comparison (Error Detection)
//
// |----[NE]---( Error_Detected )----|
// | IN1: Actual_Position             |
// | IN2: Commanded_Position          |

Structured Text Example

Error_Detected := (Actual_Position <> Commanded_Position);

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

S

Siemens (TIA Portal)

Use CMP <> instruction in TIA Portal.

AB

Allen-Bradley (Studio 5000)

Use NEQ (Not Equal) instruction.

C

CODESYS

Use <> operator in ST or NE function block.

Common Applications

  • Change detection
  • Error/fault identification
  • Position mismatch alarms
  • Value deviation alerts

Frequently Asked Questions

What is NE (Not Equal) in PLC programming?

Returns TRUE when inputs are not equal to each other. The NE (Not Equal) comparison function returns TRUE when the two inputs are not equal to each other. It is the logical complement of EQ.

What are common applications of NE (Not Equal)?

NE (Not Equal) is commonly used for: Change detection, Error/fault identification, Position mismatch alarms, Value deviation alerts.

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

Siemens: Use CMP <> instruction in TIA Portal. Allen-Bradley: Use NEQ (Not Equal) instruction. CODESYS: Use <> operator in ST or NE function block.

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.

20
Ready-Made Templates
LD + ST
Both Languages Included
$29
One-Time Purchase
Get Instant Access -- $29

Instant download - 30-day money-back guarantee - Use on unlimited projects

Free PLC simulator

Wire this block up and run it

Drop the instruction into a rung, hit Run, and watch it execute in your browser. 12 guided lessons across 8 PLC dialects — free account, no credit card.

Practice PLCs free →