Bit.getfield() - Keithley 2601B Reference Manual

2600b series system sourcemeter instrument
Hide thumbs Also See for 2601B:
Table of Contents

Advertisement

Series 2600B System SourceMeter® Instrument Reference Manual
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 will be zero (0).
Example
testResult = bit.get(10, 4)
print(testResult)
Also see
Bit manipulation and logic operations
bit.clear()
bit.set()
(on page 7-12)
bit.test()
(on page 7-13)
bit.toggle()

bit.getfield()

This function returns a field of bits from the value starting at the specified index position.
Type
TSP-Link accessible
Function
No
Usage
result = bit.getfield(value, index, width)
result
value
index
width
Details
A field of bits is a contiguous group of bits. This function retrieves a field of bits from value starting at index.
The index position is the least significant bit of the retrieved field. The number of bits to return is specified by
width.
The least significant bit of value is at index position 1; the most significant bit is at index position 32.
Example
myResult = bit.getfield(13, 2, 3)
print(myResult)
2600BS-901-01 Rev. B / May 2013
(on page 7-10)
(on page 7-14)
Affected by
Result of the bit manipulation
Specified number
One-based bit position within value to get (1 to 32)
The number of bits to include in the field (1 to 32)
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
(on page 5-3)
Where saved
The binary equivalent of decimal 13 is 1101.
The field at index position 2 and width 3
consists of the binary bits 110. The returned value
is decimal 6 (binary 110).
Output:
6.00000e+00
Section 7: TSP command reference
Default value
7-11

Advertisement

Table of Contents
loading

This manual is also suitable for:

2604b2614b2634b2635b2636b2602b ... Show all

Table of Contents