Section 7: TSP command reference
Series 2600B System SourceMeter® Instrument Reference Manual
7-14
2600BS-901-01 Rev. C / August 2016
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)
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.01
Also see
Bit manipulation and logic operations
(on page 5-3)
(on page 7-11)
(on page 7-12)
(on page 7-12)
(on page 7-14)
(on page 7-15)
(on page 7-16)
bit.setfield()
This function overwrites a bit field at a specified index position.
Type
TSP-Link accessible
Affected by
Where saved
Default value
Function
No
Usage
result
= bit.setfield(
value
,
index
,
width
,
fieldValue
)
result
Result of the bit manipulation
value
Specified number
index
One-based bit position in
value
to set (
1
to
32
)
width
The number of bits to include in the field (
1
to
32
)
fieldValue
Value to write to the field