rslogix mask command


Thread Starter


As a student, I am just learning how to program PLC's. I am using an AB with micrologix1000, and am having a hard time understanding the application of a mask command. If anybody can tell me where to find some information on this I would appreciate it, thanks.


Masked Moves (MVM) is a bit-wise masking operation. Therefore, you need to look at the bits, or binary representation of the number you are moving. It is most commonly used to move a control value onto outputs, or inputs into a control word. For example:

We want to move The following pattern of bits onto the outputs at O:1/5 thru O:1/8 (inclusive, 4 bits). Let's say for this example that these are wired to a progrma select on a servo drive:


This would select program 3, let's say. Now we could use 4 rungs of logic and just hard code them in:

xic b3:1/5 ote O:1/5
xic B3:1/6 ote O:1/6
xic B3:1/7 ote O:1/7
xic B3:1/8 ote O:1/8


we could do a masked move of the B3 bits onto the outputs. The catch is that we do not want to alter the state of the rest of the outputs, so we do a MVM:

1 = on
0 = off
x = Don't care, do not want to alter...



The mask is a bit pattern. If the bit is 1, then it passes the value thru, if it is 0, it blocks it, so our mask needs to be:

0000 0001 1110 0000

so that we only pass thru the bits that are important from the B3 word, and do not pass thru anything else. In order to use the MVM, you need to enter the mask value as a decimal or hex number (hex is easier), so our mask value is 0x01E0. Therefore, our final instruction would be:


Source 1 : B3:1
Mask : 0x01E0
Dest : O:1

This may seem trivial with this example, but there are places where it is good to use. This example is fairly contrived, but hopefully it helps clear it up....


--Joe Jansen