Equal To (EQ)

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 EQ instruction and the operator = test whether Source A is equal to Source B.
TIP: In Logix Designer version 36, the mnemonic for this instruction changed from EQU to EQ.
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.
EQU_f_avail lang
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
Source 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 the 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
EQU
FBD_COMPARE
tag
EQ 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 equal to SourceB. Cleared to false when SourceA is not equal to SourceB.
FBD Function
TIP:
FBD Function is applicable to 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 equal to SourceB. Cleared to false when SourceA is not equal to SourceB.
Affects Math Status Flags
No
Major/Minor Faults
See
EQ 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 and Source B are not NANs and Source A is equal to Source B.
Set Rung-condition-out to true
else
Clear Rung-condition-out to false.
String compare:
See EQU 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 and SourceB are not NANs and SourceA is 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 and SourceB are not NANs and SourceA is 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
EQ String Compare Flow Chart
EQ_stringcompareflowchart_v33
Examples
Ladder Diagram
Function Block Diagram
FBD Block
FBD Function
EQ_f_ex
Structured Text
if value_1 = value_2 then
  light_a := 1;
else
  light_a := 0;
end_if;
if value_3 = ’I am EQUAL’ then
  light_b := 1;
else
  light_b := 0;
end_if;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.