Mask Equal To (MEQ)

This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The MEQ instruction passes the Source and Compare values through a Mask and compares the results.
Available Languages
Ladder Diagram
RSL5K_MEQ Ladder Diagram_v31
Function Block Diagram
Function Block Diagram supports these elements:
FBD Block
RSL5K_MEQ Function Block_v31
FBD Function
TIP:
FBD Function is applicable to CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers only.
MEQ_avail lang FBD func
Structured Text
This instruction is not available in structured text.
Operands
There are data conversion rules for mixing numeric data types within an instruction. See Data Conversions.
Ladder Diagram
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
SINT
INT
DINT
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
immediate
tag
Value to test against Compare.
Mask
SINT
INT
DINT
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
immediate
tag
Which bits to block or pass.
Compare
SINT
INT
DINT
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
immediate
tag
Value to test against Source.
Function Block Diagram
FBD Block
Operand
Data Type
Format
Description
MEQ
FBD_MASK_EQUAL
tag
MEQ structure
FBD_MASK_EQUAL 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.
Source
DINT
Value to test against Compare.
Mask
DINT
Defines which bits to block, such as mask.
Compare
DINT
Value to test against Source.
Output Members
Data Type
Description
EnableOut
BOOL
Indicates if the instruction executed without fault when it was enabled.
Dest
BOOL
Set to true when result is true. Cleared to false when result is false.
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
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers
Description
Source
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
Value to test against Compare.
Mask
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
Which bits to block or pass.
Compare
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
Value to test against Source.
A SINT or INT tag is converted to a DINT value by zero-fill.
Output Operand (Right Pin)
Data Type
Description
Dest
BOOL
Set to true when result is true. Cleared to false when result is false.
Operation
A "1" in the mask means the data bit is passed. A "0" in the mask means the data bit is blocked. Typically, the Source, Mask, and Compare values are all the same data type.
If using SINT or INT data type, the instruction fills the upper bits of that value with 0s so that it is the same size as the DINT data type.
Enter an immediate mask value
When entering a mask, the programming software defaults to decimal values. To enter a mask using another format, precede the value with the correct prefix.
Prefix
Description
16#
hexadecimal, such as 16#0F0F
8#
octal, such as 8#16
2#
binary, such as 2#00110011
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. 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
Refer to MEQ Flow Chart (True).
If output is true
Set Rung-condition-out to true
else
Clear Rung-condition-out to false
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
Set EnableOut to EnableIn.
Refer to
MEQ Flow Chart (True)
.
If output is true
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
Refer to
MEQ Flow Chart (True)
.
If output is true
Set Dest to true
else
Clear Dest to false
Instruction first run
N/A
Instruction first scan
N/A
Postscan
N/A
MEQ Flow Chart (True)
MEQ Flow Chart (True)
Examples
Example 1
If the masked value_1 is equal to the masked value_2, set light_1 to true. If the masked value_1 is not equal to the masked value_2, clear light_1 to false.
This example shows that the masked values are equal. A 0 in the mask restrains the instruction from comparing that bit (indicated by an x in the example).
Ladder Diagram
MEQ Example 1
RSL5K_MEQ Ladder Diagram Example 1_v31
Function Block Diagram
FBD Block
RSL5K_MEQ Function Block Example 1_v31
FBD Function
RSL5K_MEQ_FBD function example
Example 2
If the masked value_1 is equal to the masked value_2, set light_1 to true. If the masked value_1 is not equal to the masked value_2, clear light_1 to false.
This example shows that the masked values are not equal. A 0 in the mask restrains the instruction from comparing that bit (indicated by an x in the example).
Ladder Diagram
MEQ Example 2
RSL5K_MEQ Ladder Diagram Example 2_v31
Function Block Diagram
FBD Block
RSL5K_MEQ Function Block Example 2_v31
FBD Function
MEQ_FBD function example 2
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.