XOR block
Short summary
Name |
XOR |
→POU type |
|
Category |
|
Conform to →IEC-standard |
no restrictions |
Graphical interface |
|
Available since |
|
Functionality
The block returns the result of a bitwise EXCLUSIVE-OR operation of all values connected to the inputs .
Inputs, return value
|
Identifier |
Description |
|
Inputs: |
IN1 |
BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT) |
1st value |
IN2 |
BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT) |
2nd value |
|
... (extensible until) |
|||
IN16 |
BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT) |
16th value |
|
Return value: |
– |
BOOL, BYTE, WORD, DWORD or LWORD(corresponds to →generic data type ANY_BIT) |
|
Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.
Example for usage within ST-editor
PROGRAM Test
VAR
result1, result2, result3, result4 : BOOL;
END_VAR
result1 := XOR(IN1 := FALSE, IN2 := FALSE); (* The variable
'result1'
evaluates to
'FALSE'
. *)
result2 := XOR(IN1 := FALSE, IN2 := TRUE ); (* The variable
'result2'
evaluates to
'TRUE'
. *)
result3 := XOR(IN1 := TRUE, IN2 := FALSE); (* The variable
'result3'
evaluates to
'TRUE'
. *)
result4 := XOR(IN1 := TRUE, IN2 := TRUE ); (* The variable
'result4'
evaluates to
'FALSE'
. *)
END_PROGRAM
When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.