Bit

Description:              This function returns the on/off status of a bit in a number.

Returns:                    Boolean

Usage:                       Script or Steady State

Format:                      Bit(Value, BitNumber)

Parameters:             Value    { numeric }  { required }  { no default: }

                                                Any numeric expression giving the number containing the bit to be tested.

                                    BitNumber    { numeric }  { required }  { no default: }

                                                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.

See Also:

And | SetBit