Bit XOR
ActionStep Reference » Programming » Number Operation » Logic » Bit XOR
The Bit XOR ActionStep performs a bitwise exclusive OR (XOR) operation and stores the result in the Result parameter of the result list. Allowed number types include both Signed and Unsigned.
- Open the Programming node in the Workspace Explorer.
- Open the Number Operation node.
- In the Logic node, select the Bit XOR ActionStep.
Parameters:
The ActionStep has the following input parameters:
NAME |
DESCRIPTION
|
---|---|
Number Type
|
Specifies the data type to be used for a number.
Allowed Context Scopes [Fixed, Local, Global] Allowed Values [Signed Number, Unsigned Number] |
Pattern 1
|
The first number.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Pattern 2
|
The second number.
Allowed Context Scopes [Fixed, Local, Global] Allowed Context Types [Variable, Parameter, Enum] |
Results:
The ActionStep returns the following results:
NAME
|
DESCRIPTION
|
---|---|
Result |
Contains the result of the bitwise exclusive OR operation.
Allowed Context Scopes [Fixed, Local, Global] Allowed Number System [Binary, Decimal, Hexadecimal] |
The number type set in the ActionStep Bit XOR determines the data type of its Result even if the variables and/or parameters that were set for patterns 1 and 2 are of different data types. |
Remarks:
The Bit OR ActionStep performing a bitwise OR operation will display the value of 1 if one or both of the patterns has a bit value of 1. The ActionStep returns the following results:
BIT IN PATTERN 1
|
BIT IN PATTERN 2
|
BIT IN RESULT |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
The Bit XOR ActionStep executes the bitwise exclusive OR operation that is represented by the two's complement. |
Example 1 (Implement bitwise XOR for two variables):
This example executes the bitwise XOR operation for the local Switch 1 and Switch 2 variables with an Unsigned Number data type. The result is changed from Decimal to Hexadecimal value with the conversion operation and is then output via the Message Box