Logical Operation
AND(&) Operator
AND Operator, or & Operator compares the bits of two operands. If the correlated bits are both 1, the result bit becomes 1.
Format: Expression1 AND Expression2 or Expression1 & Expression2
In Expression1 and 2, a constant, PLC Device variable (the value that PLC Device has) and the Expressions listed in [Expressions] can be used.
Bit operation truth table
Expression 1 | Expression 2 | Result |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
Example
Example | Description |
MX00 := 1; MX01 := 0; MX10 := MX00 AND MX01; | 0 (The result of 1 AND 0) is substituted to MX10. |
OR 연산자
OR Operator compares the bits between 2 operands. If any of the correlated bit is 1, the result bit becomes 1.
Format: Expression1 OR Expression2
In Expression1 and 2, a constant, PLC Device variable (the value that PLC Device has) and the Expressions listed in [Expressions] can be used.
Bit operation truth table
Expression 1 | Expression 2 | Result |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
Example
Example | Description |
MX00 := 1; MX01 := 0; MX10 := MX00 OR MX01; | 0 (The result of 1 OR 0) is substituted to MX10. |
XOR Operator
XOR Operator compares the bits between 2 operands. If one of the correlated bit is 1, the result bit becomes 1. But if both of the correlated bits are 1, the result will be 0.
Format: Expression1 XOR Expression2
In Expression1 and 2, a constant, PLC Device variable (the value that PLC Device has) and the Expressions listed in [Expressions] can be used.
Bit operation truth table
Expression 1 | Expression 2 | Result |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
Example
Example | Description |
MX00 := 1; MX01 := 1; MX10 := MX00 XOR MX01; | 0 (The result of 1 XOR 0) is substituted to MX10. |
NOT Operator
NOT operator reverses the bits of the operand. If the bits of operand are 1, the result will be 0. Then if the bits of operand are 0, the result will be 1.
Format: NOT Expression1
In Expression1 and 2, a constant, PLC Device variable (the value that PLC Device has) and the Expressions listed in [Expressions] can be used.
Bit operation truth table
Expression 1 | Result |
0 | 1 |
1 | 0 |
Example
Example | Description |
MX00 := NOT 0; | 1 (The result of NOT 0) is substituted to MX00. |