Allen Bradley

MEQ [Masked Comparison for Equal] "This conditional instruction compares 16-bit data of a source address to 16-bit data at a reference address through a mask. If the values match, the instruction is true. This instruction allows portions of the data to be masked by a separate word."


Straight from the RSLogix 500 instruction help menu....

I've used it to filter out a status word to determine what errors may have occurred.
 
This might be a bad example in the fact that I am self taught but maybe laymans terms will help. This is my understanding:

Lets say your masking a 32 bit word with the mask of 256, what your doing is only examining the first 8 bits. eg,
bit 0=1 binary value(mask)
1=2
2=4
3=8
4=16
5=32
6=64
7-128
8=256

The mask is ignoring the rest of the word. If you mask with 32, your only examining the first 6 bits of the source. I hope this is right. I haven't really used them, just heard.It should be enough to peice it together.
 
Hi Wagner.
Close but not quite right.

If the have a mask of decimal value 32 then you will only be comparing bit 5 (the sixth bit counting from bit 0)
If you want to compare all the the first 6 bits (bits 0-5) then the mask value must be equal to 63. ie bit 0, 1, 2, 3, 4 and 5 on.

(don't forget to count bit positions from right to left)

EG
Source: x0 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0
Mask: xxx0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 xxxxxxThis mask is equal to 63
Compare: 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 xxxxxxThe compare is the result.

Notice the mask blocks the "on" bits at position 6, 8, 10 and 12 from being passed from the source to the compare.
Hope this is enlightening.

I couldnt make the bits line up with spaces. Had to put in xxs to get them nearly correct.

Regards Alan Case
 
Last edited:

Similar Topics

Currently trying to find: micrologix ethernet interface 1761-NET-ENI AIC to micrologix 761-CBL-AM00 Ser C cable These are used for micrologix...
Replies
2
Views
32
in allen bradley kinetix 300 drive first E31 error shows after resting drive E11 error occurs need solution to reset E11 fault code
Replies
4
Views
160
Hi, I have a ControlLogix system with 1756-IF16 analogue inputs. I can't scale the inputs at the card as there is a requirement to facilitate...
Replies
14
Views
443
Dear community, I am trying to find a tool for Allen-Bradley PLCs similar to SiVArch for Siemens PLCs to automatically generate faceplates and...
Replies
0
Views
115
Hi everyone, new to forum. Since very long time i having issue with 1734-AENT module, after some period of time its keep stuck in error (simmilar...
Replies
23
Views
1,010
Back
Top Bottom