Bitwise AND AND
Dest gets the bits that are on in both A and B.
BITWISE_AND
AGlobal.Word112BGlobal.Word210DestGlobal.WordOut8
| Tag | After two scans |
|---|---|
| Word1 | 12 |
| Word2 | 10 |
| WordOut | 8 |
How it works
While the rung is true, each bit of Dest is on only where that bit is on in both A and B. A false rung changes nothing.
How it's used
Use AND with a mask to keep only some bits of a word.
BITWISE_AND
AGlobal.Inputs182B15DestGlobal.Low46
| Tag | Value |
|---|---|
| Inputs | 182 |
| Low4 | 6 |
Mask 15 keeps the lowest four bits: 182 becomes 6.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| A | DINT or a number | Reads |
| B | DINT or a number | Reads |
| Dest | DINT | Writes |
Common mistakes
- Using BOOL tagsWord logic works on whole DINT words, 32 bits at once.