Skip to main content

Operator: XOR

The IEC operator is used for the bitwise XOR of bit operands.

When only one of the two input bits yields 1, the output bit also yields 1. When both inputs yield 1 or 0, then the output yields 0.

Permitted data types: BOOL, BYTE, WORD, DWORD, LWORD

Important

Note the following behavior of the XOR POU in extended form (more than two inputs): compares the inputs in pairs and then the corresponding results (according to the standard, but not necessarily according to expectations).

Example 116. Examples

Result in var1: 2#0001_1001

ST

var1 := 2#1001_0011 XOR 2#1000_1010;

FBD

_cds_img_xor.png