Mask Equal To (MEQ)
The MEQ instruction passes the Source and Compare values through a Mask and compares the results.
Available Languages
Ladder Diagram
Operands
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
Operand | Data Type | Format | Description |
---|---|---|---|
Source | SINT INT DINT LINT USINT UINT UDINT ULINT | immediate tag | Value to test against Compare. |
Mask | SINT INT DINT LINT USINT UINT UDINT ULINT | immediate tag | Which bits to block or pass. |
Compare | SINT INT DINT LINT USINT UINT UDINT ULINT | immediate tag | Value to test against Source. |
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 arraysfor 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 |
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
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
Provide Feedback