Masked Move with Target (MVMT)
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 MVMT instruction copies the Source to a Destination and allows portions of the data to be masked.
Available Languages
Ladder Diagram
This instruction is not available in Ladder Diagram.
Function Block
Structured Text
MVMT(MVMT_tag);
Operands
Structured Text
Variable | Type | Format | Description |
---|---|---|---|
MVMT tag | FBD_MASKED_MOVE | Structure | MVMT structure |
See Structured Text Syntax for information on the syntax of expressions within structured text.
Function Block
Operand | Type | Format | Description |
---|---|---|---|
MVMT tag | FBD_MASKED_MOVE | Structure | MVMT structure |
FBD_MASKED_MOVE Structure
Input Parameter | Data Type | Description |
---|---|---|
EnableIn | BOOL | If cleared, the instruction does not execute and outputs are not updated. If set, the instruction executes.
Default is set. |
Source | DINT | Input value to move to Destination based on value of Mask.
Valid = any integer |
Mask | DINT | Mask of bits to move from Source to Dest. All bits set to one cause the corresponding bits to move from Source to Dest. All bits that are set to zero cause the corresponding bits not to move from Source to Dest.
Valid = any integer |
Target | DINT | Input value to move to Dest prior to moving Source bits through the Mask.
Valid = any integer |
Output Parameter | Data Type | Description |
---|---|---|
EnableOut | BOOL | Indicates if instruction is enabled. |
Dest | DINT | Result of the masked move operation. |
Description
When enabled, the MVMT 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 you mix integer data types, 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 using an Input Reference
When you enter a mask, the programming software defaults to decimal values. If you want 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) |
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 for the output |
Major/Minor Faults
None specific to this instruction. See
Common Attributes
for operand-related faults.Execution
Function Block
Condition/State | Action Taken |
---|---|
Prescan | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is false | EnableIn and EnableOut bits are cleared to false. |
Tag.EnableIn is true | EnableIn and EnableOut bits are set to true. The instruction executes. |
Instruction first run | N/A |
Instruction first scan | N/A |
Postscan | EnableIn and EnableOut bits are cleared to false. |
Structured Text
Condition/State | Action Taken |
---|---|
Prescan | See Prescan in the Function Block table. |
Normal execution | See Tag.EnableIn is true in the Function Block table. |
Postscan | See Postscan in the Function Block table. |
Examples
Step 1
The controller copies Target into Dest.
Step 2
The instruction masks Source and compares it to Dest. Any required changes are made in Dest, which becomes and input parameter to value_masked. Source and Target remain unchanged. A 0 in the mask restrains the instruction from comparing that bit.
Function Block
Structured Text
MVMT_01.Source := value_1;
MVMT_01.Mask := mask_1;
MVMT_01.Target := target;
MVMT(MVMT_01);
value_masked := MVMT_01.Dest;
Provide Feedback