Bit.set() - Keithley 2651A Reference Manual

High power system sourcemeter instrument
Hide thumbs Also See for 2651A:
Table of Contents

Advertisement

Model 2651A High Power System SourceMeter® Instrument Reference Manual
Example
myResult = bit.getfield(13, 2, 3)
print(myResult)
Also see
bit.get()
(on page 7-11)

bit.set()

(on page 7-13)
bit.setfield()
(on page 7-14)
Logical operators
bit.set()
This function sets a bit at the specified index position.
Type
TSP-Link accessible
Function
No
Usage
result = bit.set(value, index)
result
value
index
Details
This function returns result, which is value with the indexed bit set. The index must be between 1 and 32.
The least significant bit of value is at index position 1; the most significant bit is at index position 32.
Any fractional part of value is truncated to make it an integer.
Example
testResult = bit.set(8, 3)
print(testResult)
2651A-901-01 Rev. A / March 2011
(on page 6-22)
Affected by
Result of the bit manipulation
Specified number
One-based bit position within value to set (1 to 32)
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
Where saved
Default value
The binary equivalent of decimal 8 is 1000. If the bit at
index position 3 is set to 1, the returned value is
decimal 12 (binary 1100).
Output:
1.20000e+01
Section 7: Command reference
7-13

Advertisement

Table of Contents
loading

Table of Contents