Masked Move (MVM)
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. Controller differences are noted where applicable.The MVM instruction copies the Source to a Destination and allows portions of the data to be masked.
The MVM instruction uses a Mask to pass or block Source data bits. A "1" in the mask means the data bit is passed; a "0" in the mask means the data bit is blocked.
If integer data types are mixed, the instruction fills the upper bits of the smaller integer data types with 0s so that they are the same size as the largest data type.
Entering an immediate mask value
When mask is entered, 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 (e.g., 16#0F0F) |
8# | Octal (e.g., 8#16) |
2# | Binary (e.g., 2#00110011) |
Available Languages
Ladder Diagram
Function Block
This instruction is not available in function block.
Structured Text
This instruction is not available in structured text.
Operands
IMPORTANT:
Unexpected operation may occur if:
- Output tag operands are overwritten.
- Members of a structure operand are overwritten.
- Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixed data types within an instruction. See
Data Conversions
.Ladder Diagram
Operand | Data Type | Format | Description |
---|---|---|---|
Source | SINT INT DINT | immediate tag | Value to move |
Mask | SINT INT DINT | immediate tag | Which bits to block or pass |
Dest | SINT INT DINT | tag | Tag to store the result |
Affects Math Status Flags
Controllers | Affects Math Status Flags |
---|---|
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers | No |
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers | Yes |
Major/Minor Faults
Controllers | A minor fault will occur if: | Fault Type | Fault Code |
---|---|---|---|
CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, Compact GuardLogix 5380, and GuardLogix 5580 controllers | The feature is enabled and overflow is detected | 4 | 4 |
CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, and GuardLogix 5570 controllers | N/A | N/A | N/A |
See Index Through Arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Rung-condition-in is false | N/A |
Rung-condition-in is true | The instruction passes the Source through the Mask and copies the result into the Destination. Unmasked bits in the Destination remain unchanged. |
Postscan | N/A |
Example
Ladder Diagram
Row 1: value_b before MVM
Row 2: value_a
Row 3: mask_2
Row 4: value_b after MVM
Copy data from value_a to value_b, while allowing data to be masked (a 0 masks the data in value_a).
Provide Feedback