Masked Move (MVM)
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
FactoryTalk Design Studio
DSL - Ladder DiagramOperands
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
No
Major/Minor Faults
A minor fault will occur if: | Fault Type | Fault Code |
---|---|---|
The feature is enabled and overflow is detected | 4 | 4 |
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