Bit
Description: | Returns the on/off status of a bit in a number. |
Returns: | Boolean |
Usage | Script or steady state. |
Function Groups: | Bitwise Operation |
Related to: | And | SetBit |
Format: | Bit(Value, BitNumber) |
Parameters: |
Value |
Required. Any numeric expression giving the number containing the bit to be tested. |
BitNumber |
Required. Any numeric expression in the range of 0 to 31 giving the bit number to be tested within the number specified by the Value parameter. Bit 0 is the least significant bit. Any value outside the range of 0 to 31 will result in a false result for Bit. |
Comments:
Bit returns true (1) if the indicated bit is 1, and false (0) if the indicated bit is 0.
Example:
motorFault = Bit(motorStatus, 0);
The example above sets motorFault to the value of the least significant bit (LSB) of motorStatus.