e.g. 'Expression1' bw_AND 'Expression2'
Overview
|
Operation |
Function |
|---|---|
|
bw_AND |
Bitwise AND |
|
bw_OR |
Bitwise OR |
|
bw_XOR |
Bitwise XOR |
|
bw_NOT |
Bitwise NOT |
Description
The result of this function is the bitwise combination of two analog values. Preferably, this function is to be applied to datatypes like BYTE, WORD, INTEGER etc.
With floating point values (FLOAT), only the integer part will be considered, because the value is converted internally into a 32 bit integer, not rounded.
Examples
By means of a combination of two decimal numbers the following table shows the result of the operations.
Bitwise AND (bw_AND)
[Value A] bw_AND [Wert B]
|
Value A = 25 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
|
Value B = 14 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
|
Result bw_AND (decimal = 8) |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
Bitwise OR (bw_OR)
[Value A] bw_OR [Wert B]
|
Value A = 25 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
|
Value B = 14 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
|
Result bw_OR (decimal = 31) |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
Bitwise XOR (bw_XOR)
[Value A] bw_XOR [Wert B]
|
Value A = 25 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
|
Value B = 14 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
|
Result bw_XOR (decimal = 23) |
0 |
0 |
0 |
1 |
0 |
1 |
1 |
1 |
Bitwise NOT (bw_NOT)
Returns the complement of the bits of a value.
bw_NOT([Value A])
|
Value A = 25 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
|
Result bw_NOT (decimal = -26) |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |