Keithley SourceMeter 2600 Series Reference Manual page 292

Table of Contents

Advertisement

12-18 Instrument Control Library
bit.test
Function
Returns the Boolean value (true or false) of a bit at a given index position.
Usage
value = bit.test(value1, index)
value1
index
value
• This function returns
Remarks
bit of the given number is at index 1. The most significant bit is at index 32.
• Any fractional part of
bit for
value1
• If the index is bigger than the number of bits in
• See
Also see
bit.clear, bit.get, bit.getfield, bit.set, bit.setfield,
The binary equivalent of decimal 10 is 1010. Testing the bit at index position 4 will
Example
return a Boolean
value = bit.test(10, 4)
print(value)
Output:
bit.toggle
Function
Toggles the value of a bit at a given index position.
Usage
value = bit.toggle(value1, index)
value1
index
value
• This function returns
Remarks
• Any fractional part of
decimal
index 1. The most significant bit is index 32.
• The indexed bit for
• See
Also see
bit.clear, bit.get, bit.getfield, bit.set, bit.setfield,
The binary equivalent of decimal 10 is 1010. Toggling the bit at index position 3 will
Example
return a decimal
value = bit.toggle(10, 3)
print(value)
Output:
2600S-901-01 Rev. A / May 2006
Given number.
Index position of the bit to be tested (1 to 32).
Returned decimal value of the bit.
value
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.
"Logic and bit
operations" on
of true:
value
true
Given number.
Index position of the bit to be toggled (1 to 32).
Returned value of the new number.
value
value1
is also an integer. The least significant bit of the given number is
value
value1
"Logic and bit
operations" on
of 14 (binary 1110).
value
1.400000e+01
Return to
Series 2600 System SourceMeters Reference Manual
, which is the result of the tested bit. The least significant
will be truncated to make it an integer. If the indexed
value1
page 12-13
for more information.
bit.toggle
, which is the result of toggling a bit in
is truncated to make it an integer. The returned
is toggled from 0 to 1, or 1 to 0.
page 12-13
for more information.
bit.test
Section 12 topics
, the result will be false.
.
value1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents