
19-26
Return to
2600AS-901-01 Rev. B / September 2008
Section 19: Remote Commands
Series 2600A System SourceMeter® Instruments Reference Manual
bit.get
Function
Retrieves the weighted value of a bit at a given index position.
TSP-Link
accessibility
This function cannot be accessed from a remote TSP-Link node.
Usage
value = bit.get(value1, index)
value1
Given
number.
index
Index position of the bit to be retrieved (1 to 32).
value
Returned weighted value of the bit.
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
Also see
,
,
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.00
bit.getfield
Function
Returns a field of bits starting at a given index position.
TSP-Link
accessibility
This function cannot be accessed from a remote TSP-Link node.
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.
Also see
Example
The binary equivalent of decimal 13 is 1101. The field at
index2
and
width3
consists of the
binary bits 110. The returned
value
will be decimal 6 (binary 110):
value = bit.getfield(13, 2, 3)
print(value)
Output:
6.00