Masked move MASKED MOV
Copies only the bits of Source that Mask picks into Dest.
How it works
While the rung is true, each bit of Dest that is on in Mask takes that bit from Source. Every other bit of Dest stays as it was. A false rung changes nothing.
How it's used
Use it to change some bits of a word and keep the others, such as two valve bits in an output word.
MASKED_MOVE
SourceGlobal.Command13MaskGlobal.Mask3DestGlobal.Valves241
| Tag | Value |
|---|---|
| Command | 13 |
| Mask | 3 |
| Valves | 241 |
Mask picks bits 0 and 1. Only those bits come from Command, so Valves is 241: its upper bits stay as they were.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| Source | DINT or a number | Reads |
| Mask | DINT or a number | Reads |
| Dest | DINT | Reads and writes |
Common mistakes
- Expecting the bits outside Mask to clearOnly the bits that are on in Mask change. To clear the others, MOV 0 into Dest first.