Not Equal To (NE)

This table lists the controllers and applications that support this instruction.
Architecture
Standard applications
Safety applications
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers
Yes
No
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Yes
Yes
When enabled, the Not Equal To (NE) instruction and the <> operator tests whether Source A is not equal to Source B.
TIP: In Logix Designer version 36, the mnemonic for this instruction changed from NEQ to NE.
Available Languages
Ladder Diagram
Function Block Diagram
Function Block Diagram supports these elements:
FBD Block
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
RSL5K_NE AvailLanguages_FBD_v31
Structured Text
This instruction is not available in structured text.
TIP:
Use the <> operator with an expression to achieve the same result. Refer to Structured Text Syntax for more information on the syntax of expressions and assignments within structured text.
Operands
There are data conversion rules for mixing numeric data types within an instruction. See
Data Conversions
.
Ladder Diagram
Numeric Comparison
Operand
Data Type
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers
Data Type
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Format
Description
Source A
SINT
INT
DINT
REAL
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
TIME
TIME32
LTIME
DT
LDT
immediate
tag
Value to test against Source B
Source B
SINT
INT
DINT
REAL
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
TIME
TIME32
LTIME
DT
LDT
immediate
tag
Value to test against Source A
TIP:
See Time and date data types for a complete description of Relative Time (LTIME, TIME, and TIME32) and Absolute Time (LDT and DT) data types.
String Comparison
TIP:
Immediate string literals are only applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers.
Operand
Data Type
Format
Description
Source A
String type
immediate literal value
tag
String to test against Source B
Source B
String type
immediate literal value
tag
String to test against Source A
Function Block Diagram
FBD Block
Operand
Data Type
Format
Description
NEQ
FBD_COMPARE
tag
NE structure
FBD_COMPARE Structure
Input Members
Data Type
Description
EnableIn
BOOL
Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true.
SourceA
REAL
Value to test against SourceB.
SourceB
REAL
Value to test against SourceA.
Output Members
Data Type
Description
EnableOut
BOOL
Indicates if the instruction is enabled.
Dest
BOOL
Set to true when SourceA is not equal to SourceB. Cleared to false when SourceA is equal to SourceB.
FBD Function
TIP: FBD Function is applicable to the CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Input Operands (Left Pins)
Data Type
Description
SourceA (top)
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Value to test against SourceB
SourceB (bottom)
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Value to test against SourceA.
Output Operand (Right Pin)
Data Type
Description
Dest
BOOL
Set to true when SourceA is not equal to SourceB. Cleared to false when SourceA is equal to SourceB.
SeeFBD FunctionsFBD Functions
Affects Math Status Flags
No
Major/Minor Faults
See
NE String Compare Flow Chart
for faults.
See Index Through Arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
N/A
Rung-condition-in is false
Set Rung-condition-out to Rung-condition-in
Rung-condition-in is true
Numeric compare:
If Source A or Source B is NAN or Source A is not equal to Source B.
Set Rung-condition-out to true
else
Clear Rung-condition-out to false.
String compare:
See
NE String Compare Flow Chart
.
If output is false
Clear Rung-condition-out to false
else
Set Rung-condition-out to true
Postscan
N/A
Function Block Diagram
FBD Block
Condition/State
Action Taken
Prescan
N/A
EnableIn is false
Set EnableOut to EnableIn
EnableIn is true
Numeric compare:
Set EnableOut to EnableIn
If SourceA or SourceB is NAN or SourceA is not equal to SourceB.
Set Dest to true
else
Clear Dest to false.
Instruction first run
N/A
Instruction first scan
N/A
Postscan
N/A
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
Condition/State
Action Taken
Prescan
N/A
Normal Scan
Numeric compare:
If SourceA or SourceB is NAN or SourceA is not equal to SourceB.
Set Dest to true
else
Clear Dest to false.
Instruction first run
N/A
Instruction first scan
N/A
Postscan
N/A
NE String Compare Flow Chart
SourceA.LEN and SourceB.LEN are handled as unsigned values.
NE_stringcompareflowchart_v33
Examples
Ladder Diagram
Function Block Diagram
FBD Block
FBD Function
NE_FBD Block ex
Structured Text
if value_1 <> value_2 then
  light_4 := 1;
else
  light_4 := 0;
end_if;
if value_3 <> ’I am EQUAL’ then
  light_5 := 1;
else
  light_5 := 0;
end_if;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.