# CODESYS XOR

Instructions · `XOR` · verification: source checked

XOR is an IEC operator that performs a bitwise exclusive OR on bit operands. For two input bits, the output is 1 only when exactly one input is 1; if both inputs are 1 or both are 0, the output is 0. The operator is permitted for BOOL, BYTE, WORD, DWORD and LWORD data types.

## Specification

| Property | Value |
|---|---|
| Language | iec 61131 3 |
| Code | XOR |
| Group | bitwise |
| Dialect | CODESYS |

## Study notes

- Permitted data types: BOOL, BYTE, WORD, DWORD, LWORD.
- For an XOR POU with more than two inputs, the inputs are compared in pairs and then the corresponding results.
- Example: 2#1001_0011 XOR 2#1000_1010 gives var1 = 2#0001_1001.

## Sources

1. [Beckhoff Information System](https://infosys.beckhoff.com/content/1033/tc3_plc_intro/2528918411.html) (accessed 2026-10-26)
2. [CODESYS Group](https://content.helpme-codesys.com/en/CODESYS%20Development%20System/_cds_operator_xor.html) (accessed 2026-10-26)

---

Source page: https://machineschema.com/instruction/iec-xor  
JSON: https://machineschema.com/instruction/iec-xor.json  
License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Cite Machine Schema and the original sources.
