User manual

Series 3700 System Switch/Multimeter Reference Manual Section 13: Instrument Control Library (ICL)
3700S-901-01 Rev. C / July 2008 13-21
bit.getfield()
Also see
Logic and bit operations (on page 13-17)
bit.clear() (on page 13-19)
bit.get() (on page 13-19)
bit.set() (on page 13-21)
bit.setfield() (on page 13-21)
bit.test() (on page 13-22)
bit.toggle() (on page 13-23)
Example
The binary equivalent of decimal 13 is 1101. The field at index 2 and width 3 consists
of the binary bits 110. The returned value will be decimal 6 (binary 110):
value = bit.getfield(13, 2, 3)
Output: 6.000000e+00
bit.set()
Function
Sets a bit at a given index position.
Usage
value = bit.set(value1, index)
value1: Given number.
index: Index position of the bit to be set (1 to 32).
value: Returned value of the new number.
Remarks
This function returns value, which is value1 with the indexed bit set. The index
must be a value between 1 and 32. The least significant bit of the given number
has an index of 1 and the most significant bit has an index of 32.
Any fractional part of value1 will be truncated to make it an integer.
Also see
Logic and bit operations (on page 13-17)
bit.clear() (on page 13-19)
bit.get() (on page 13-19)
bit.getfield() (on page 13-20)
bit.setfield() (on page 13-21)
bit.test() (on page 13-22)
bit.toggle() (on page 13-23)
Example
The binary equivalent of decimal 8 is 1000. If the bit at index 3 is set to 1, the returned
value will be decimal 12 (binary 1100):
value = bit.set(8, 3)
Output: 1.200000e+01