Series 2600B System SourceMeter® instrument Reference Manual Section 9: TSP command reference
2600BS-901-01 Rev. F/August 2021 9-11
bit.get()
This function retrieves the weighted value of a bit at a specified index position.
Usage
result = bit.get(value, index)
Result of the bit manipulation
One-based bit position within value to get (1 to 32)
Details
This function returns the value of the bit in value at index. This is the same as returning value with
all other bits set to zero (0).
The least significant bit of value is at index position 1; the most significant bit is at index
position 32.
If the indexed bit for the number is set to zero (0), the result is zero (0).
Example
testResult = bit.get(10, 4)
print(testResult)
The binary equivalent of decimal 10 is 1010. If you get the bit at index position 4, the returned decimal value is
8.
Output:
8.00000e+00
Also see
Bit manipulation and logic operations (on page 7-4)
bit.clear() (on page 9-10)
bit.set() (on page 9-13)
bit.test() (on page 9-15)
bit.toggle() (on page 9-16)