6.1.3.5.3 XOR
Function
Perform an "XOR" operation on the values of IN1...INn according to binary bits, and output the result at OUT
LD Graphics
Parameter description
| Interface variable | Declaration | Data type | Description |
|---|---|---|---|
| IN1 | Var_Input | ANY_BIT | Operand |
| IN2 | Var_Input | ANY_BIT | Operand |
| OUT | Var_Output | ANY_BIT | Output result |
warning
- XOR is an extensible function, and inputs can be added by clicking the "+" in the graph
- IN1...INn data types need to be consistent and the same as OUT
- ANY_BIT data types include BYTE, WORD, DWORD, and LWORD
- ST language operator: XOR
Example
Perform an "XOR" operation on bit 0 of the value input to IN1 and bit 0 of the value input to IN2. The result is stored in bit 0 of the output OUT. The same logical operation is performed on all other bits of the specified value. As shown in the figure below, the result of 15 "XOR" 36 is 43
| Operand | value |
|---|---|
| IN1 | 0000 1111 |
| IN2 | 0010 0100 |
| OUT | 0010 1011 |
