Operator ‘XOR’¶
This 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
Attention
Please note the following behavior of the XOR
block in extended form (more than two inputs): CODESYS compares the inputs in pairs and then the corresponding results (according to the standard, but not necessarily according to expectations).
Examples
Result in var1
: 2#0001_1001
ST:
var1 := 2#1001_0011 XOR 2#1000_1010;
FBD: