Bit

(Engine-Level Function)

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 | Ones
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.

(See: Bitwise Parameters & Operations)

Example:

  MotorFault = Bit(MotorStatus, 0);

The example sets motorFault to TRUE if the right-most (least-significant) bit of motorStatus is set. to 1