Bit OR
ActionStep Reference » Programming » Number Operation » Logic » Bit OR
The ActionStep Bit OR executes a bitwise OR operation and stores the number in Result of the result list. The following number types are allowed: Signed and Unsigned.
- Open the Programming node in the Workspace Explorer.
- Open the Number Operation node.
- In the Logic node, select the Bit OR 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 OR operation. Allowed Context Scopes [Fixed, Local, Global] Allowed Number System [Binary, Decimal, Hexadecimal] |
The number type set in the ActionStep Bit OR 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 | 1 |
The Bit OR ActionStep executes the bitwise OR operation that is represented by the two's complement. |
Example 1 (Implement bitwise OR for two variables):
This example executes the bitwise OR 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.