User manual
Section 13: Instrument Control Library (ICL) Series 3700 System Switch/Multimeter Reference Manual
13-20 3700S-901-01 Rev. C / July 2008
bit.get()
Remarks
This function returns the value of the bit in value1 at the given index. This is the
same as returning value1 with all other non-indexed bits set to zero.
Prior to retrieving the indexed bit, any fractional part of the given number will be
truncated to make it an integer. The least significant bit of the given number has an
index of 1 and the most significant bit has an index of 32.
If the indexed bit for the number is set to 0, the result will be 0.
See Logic and bit operations (on page 13-17) for more information.
Also see
bit.clear() (on page 13-19)
bit.set() (on page 13-21)
bit.setfield() (on page 13-21)
bit.test() (on page 13-22)
bit.toggle() (on page 13-23)
Example
The binary equivalent of decimal 10 is 1010. Getting the bit at index position 4 will
return decimal value 8:
value = bit.get(10, 4)
print(value)
Output: 8.000000e+00
bit.getfield()
Function
Returns a field of bits starting at a given index position.
Usage
value = bit.getfield(value1, index, width)
value1: Given number.
index: Index position of the first bit; 1 to (33 - width ).
width: Field width - number of bits to be included in the field; 1 to 24.
value: Returned value of the bit field.
Remarks
A field of bits is a contiguous group of bits. This function retrieves a field of bits
from value1, starting at the given index position. The index position is the least
significant bit of the retrieved field. The number of bits to return is given by width.
Prior to retrieving the field of bits, any fractional part of the given number will be
truncated to make it an integer.
The least significant bit of the given number has an index of 1 and the most
significant bit has an index of 32.