Use bitwise operators
Bitwise operators manipulate the bits within a value based on two values.
The following provides an overview of the bitwise operators.
For | Use this operator | Optimal data type |
bitwise AND | &, AND | DINT |
bitwise OR | OR | DINT |
bitwise exclusive OR | XOR | DINT |
bitwise complement | NOT | DINT |
This is an example.
Use this format | Example | |
For this situation | Use | |
value1 operator value2 | If input1, input2, and result1 are DINT tags and your specification says: "Calculate the bitwise result of input1 and input2. Store the result in result1." | result1 := input1 AND input2; |
Provide Feedback