Keithley 3700 series Reference Manual page 159

System switch/multimeter
Hide thumbs Also See for 3700 series:
Table of Contents

Advertisement

Series 3700 System Switch/Multimeter Reference Manual
bit.setfield
Example
bit.test
Function
Usage
Remarks
Also see
Example
bit.toggle
Function
Usage
Document Number: 3700S-901-01 Rev. A / August 2007
The binary equivalent of decimal 15 is 1111. After overwriting it with a decimal 5
(binary 101) at index position 2, the returned value will be decimal 11 (binary 1011):
value = bit.setfield(15, 2, 3, 5)
print(value)
Output: 1.100000e+01
Returns the Boolean value (true or false) of a bit at a given index position.
value = bit.test(value1, index)
value1: Given number.
index: Index position of the bit to be tested (1 to 32).
value: Returned decimal value of the bit.
This function returns value, which is the result of the tested bit. The least
significant bit of the given number is at index 1. The most significant bit is at index
32.
Any fractional part of value1 will be truncated to make it an integer. If the indexed
bit for value1 is set to 0, the returned value will be false. If the indexed bit for
value1 is set to 1, the returned value will be true.
If the index is bigger than the number of bits in value1, the result will be false.
Logic and bit operations
bit.clear
(on page 9-11)
bit.get
(on page 9-12)
bit.getfield
(on page 9-12)
bit.set
(on page 9-13)
bit.setfield
(on page 9-14)
bit.toggle
(on page 9-15)
The binary equivalent of decimal 10 is 1010. Testing the bit at index position 4 will
return a Boolean value of true:
value = bit.test(10, 4)
print(value)
Output: true
Toggles the value of a bit at a given index position.
value = bit.toggle(value1, index)
value1: Given number.
index: Index position of the bit to be toggled (1 to 32).
value: Returned value of the new number.
Section 9: Instrument Control Library (ICL)
(on page 9-9)
9-15

Advertisement

Table of Contents
loading

Table of Contents