Bitwise OR OR
Dest gets the bits that are on in A or B.
BITWISE_OR
AGlobal.MaskA12BGlobal.MaskB10DestGlobal.MaskOr14
| Tag | After two scans |
|---|---|
| MaskA | 12 |
| MaskB | 10 |
| MaskOr | 14 |
How it works
While the rung is true, each bit of Dest is on where that bit is on in A, in B, or in both. A false rung changes nothing.
How it's used
Use OR to turn bits on without changing the others.
BITWISE_OR
AGlobal.Lamps5B4DestGlobal.Lamps5
| Tag | Value |
|---|---|
| Lamps | 5 |
Bit 2 turned on. Bit 0 stayed on: 1 became 5.
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 it as a rung branchOR here writes a DINT word. For either-or logic on a rung, use a branch.