Bit Manipulation And Logical Operations - Keithley 2651A Reference Manual

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

Advertisement

Section 5: Remote commands

Bit manipulation and logical operations

The bit functions perform bitwise logic operations on two given numbers, and bit operations on one
given number. Logic and bit operations truncate the fractional part of given numbers to make them
integers.
Logic operations
The bit.bitand(), bit.bitor(), and bit.bitxor() functions in this group perform logic
operations on two numbers. The Test Script Processor (TSP
logic operation on the binary equivalents of the two integers. Bitwise logic operations are performed.
This means that the logical AND, OR, or XOR operation is performed on Bit B1 of the first number
and Bit B1 of the second number. The logical AND, OR, or XOR operation is performed on Bit B2 of
the first number and Bit B2 of the second number. This bitwise logic operation is performed on all
corresponding bits of the two numbers. The result of a logic operation is returned as an integer.
Bit operations
The rest of the functions in this group are used for operations on the bits of a given number. These
functions can be used to:
Clear a bit
Toggle a bit
Test a bit
Set a bit or bit field
Retrieve the weighted value of a bit or field value
All of these functions use an index parameter to specify the bit position of the given number. The least
significant bit of a given number has an index of 1, and the most significant bit has an index of 32.
The Test Script Processor (TSP) scripting engine stores all numbers internally as IEEE Std 754
double-precision floating point values. The logical operations work on 32-bit integers. Any fractional
bits will be truncated. For numbers larger than 4294967295, only the lower 32 bits will be used.
bit.bitand()
(on page 7-9)
bit.bitor()
(on page 7-9)
bit.bitxor()
(on page 7-10)
bit.clear()
(on page 7-11)
bit.get()
(on page 7-11)
bit.getfield()
bit.set()
(on page 7-13)
bit.setfield()
bit.test()
(on page 7-15)
bit.toggle()
(on page 7-15)
5-4
Model 2651A High Power System SourceMeter® Instrument Reference Manual
(on page 7-12)
(on page 7-14)
®
) scripting engine performs the indicated
NOTE
2651A-901-01 Rev. A / March 2011

Advertisement

Table of Contents
loading

Table of Contents