Source Meter · TSP and SCPI command comparison

Keithley 2602B vs Keysight B2902B: SCPI and TSP commands and remote control compared

In TestFlow's instrument library, the Keithley 2602B takes 69 TSP commands, 14 of them queries, and the Keysight B2902B takes 62 SCPI commands, 15 of them queries. That is 7 more on the 2602B. Counting distinct command headers (the command path without its arguments), 0 are accepted by both, 52 exist only on the 2602B, and 58 only on the B2902B. The 2602B is programmed in TSP and the B2902B in SCPI, so a script written for one does not run on the other without translating each command.

Only the 2602B has smua, smub, errorqueue, localnode, beeper, and reset and 2 more. Only the B2902B has SOURce, SENSe, OUTPut, FETCh, MEASure, and READ and 6 more.

Only the 2602B library has an operation-complete command (waitcomplete()); the B2902B library has none. Only the 2602B library has an error-queue read (errorqueue.next()); the B2902B library has none.

TestFlow's library gives the 2604B, 2612B, 2614B, 2634B, and 2636B the same command set as the 2602B, so the 2602B column applies to them too. TestFlow's library gives the B2912B the same command set as the B2902B, so the B2902B column applies to it too.

2602B commands
69
B2902B commands
62
Shared headers
0
Unique headers
110

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keithley 2602B or Keysight B2902B and writes the report from the measured results.

Get started

2602B vs B2902B at a glance

Counts come from TestFlow's instrument library, the command sets its AI agent uses to drive each instrument. A distinct command header is the command path without its arguments, so :OUTPut ON and :OUTPut OFF count once.

Keithley 2602BKeysight B2902B
Commands in TestFlow's library6962
Queries (read a value or state)1415
Settings and actions5547
Subsystems1016
Distinct command headers5258
Headers the other lacks5258
Command languageTSPSCPI
Operation completewaitcomplete()Not in library
Error queueerrorqueue.next()Not in library
Models on this command set2602B, 2604B, 2612B, 2614B, 2634B, 2636BB2902B, B2912B

Commands both accept

None. No command header in TestFlow's 2602B library matches one in its B2902B library: the 2602B speaks TSP and the B2902B speaks SCPI.

Only on the Keithley 2602B

52 command headers in the 2602B library have no match in the B2902B library. Below are 12 of them from the 6 largest subsystems; the full list is in the Keithley 2602B command reference.

smua (23 only on the 2602B)

CommandWhat it does
smua.source.output = smua.OUTPUT_ONTurn On CHA. Enables the output of SMU channel A (TSP command).
smua.source.func = smua.OUTPUT_DCVOLTSSet Source Function Voltage CHA. Sets the source function of channel A to DC voltage.
smua.source.levelv = <Voltage>Set Voltage Source CHA. Sets the output voltage level in volts on channel A.
smua.source.leveli = <Amp>Set Current Source CHA. Sets the output current level in amps on channel A.

smub (23 only on the 2602B)

CommandWhat it does
smub.source.output = smub.OUTPUT_ONTurn On CHB. Enables the output of SMU channel A (TSP command).
smub.source.func = smub.OUTPUT_DCVOLTSSet Source Function Voltage CHB. Sets the source function of channel A to DC voltage.
smub.source.levelv = <Voltage>Set Voltage Source CHB. Sets the output voltage level in volts on channel A.
smub.source.leveli = <Amp>Set Current Source CHB. Sets the output current level in amps on channel A.

beeper (1 only on the 2602B)

CommandWhat it does
beeper.beep(<Duration>, <Frequency>)Beep. Sounds the beeper for the given duration and frequency.

errorqueue (1 only on the 2602B)

CommandWhat it does
print(errorqueue.next())Read Error. Reads the next message from the error queue.

localnode (1 only on the 2602B)

CommandWhat it does
print(localnode.description)Identify. Returns the instrument identification string.

reset (1 only on the 2602B)

CommandWhat it does
reset()Reset. Resets the entire instrument to its default state.

Only on the Keysight B2902B

58 command headers in the B2902B library have no match in the 2602B library. Below are 23 of them from the 6 largest subsystems; the full list is in the Keysight B2902B command reference.

SOURce (14 only on the B2902B)

CommandWhat it does
:SOURce<Channel>:FUNCtion:SHAPe <Function>Set Source Function. Sets the source output shape (DC or Pulse) for the specified channel.
:SOURce<Channel>:FUNCtion:MODE <Mode>Set Source Mode. Sets the source function mode (voltage or current sourcing) for the specified channel.
:SOURce<Channel>:VOLTage:LEVel:IMMediate:AMPLitude <Voltage>Set Voltage. Sets the DC output voltage level in volts for the specified channel (range: -21 V to +21 V).
:SOURce<Channel>:CURRent:LEVel:IMMediate:AMPLitude <Current>Set Current. Sets the DC output current level in amperes for the specified channel (range: -3 A to +3 A).

SENSe (10 only on the B2902B)

CommandWhat it does
:SENSe<Channel>:VOLTage:PROTection:LEVel <Voltage>Set Voltage Compliance. Sets the voltage compliance (protection) limit in volts for the specified channel when sourcing current.
:SENSe<Channel>:CURRent:PROTection:LEVel <Current>Set Current Compliance. Sets the current compliance (protection) limit in amperes for the specified channel when sourcing voltage.
:SENSe<Channel>:FUNCtion:ON "<Function>"Set Sense Function. Selects the measurement (sense) function for the specified channel.
:SENSe<Channel>:VOLTage:RANGe:UPPer <Range>Set Sense Voltage Range. Sets the voltage measurement range for the specified channel in volts.

IEEE 488.2 common (*) (9 only on the B2902B)

CommandWhat it does
*SAV <Register>Save State. Saves the current instrument settings (both channels) to non-volatile memory register (0 to 4).
*RCL <Register>Recall State. Recalls and restores instrument settings (both channels) from the specified non-volatile memory register.
*IDN?Identify. Queries and returns the instrument identification string (manufacturer model serial firmware).
*RSTReset. Resets the instrument to factory default settings on all channels and aborts any pending operations.

OUTPut (6 only on the B2902B)

CommandWhat it does
:OUTPut<Channel> ONTurn On. Enables the output of the specified channel (1 or 2).
:OUTPut<Channel>:STATe?Read Output State. Queries and returns the output state of the specified channel (0=OFF / 1=ON).
:OUTPut<Channel>:OFF:MODE <Mode>Set Output Off Mode. Sets the terminal condition when the output of the specified channel is turned off.
:OUTPut<Channel>:LOW <State>Set Output Low. Sets the output LO terminal to ground or floating for the specified channel when output is off.

FETCh (5 only on the B2902B)

CommandWhat it does
:FETCh:SCALar:VOLTage? (@<Channel>)Fetch Voltage. Returns the last measured voltage of the specified channel from buffer without re-triggering.
:FETCh:SCALar:CURRent? (@<Channel>)Fetch Current. Returns the last measured current of the specified channel from buffer without re-triggering.
:FETCh:SCALar? (@<Channel>)Fetch All. Returns all last measured data (voltage current resistance status timestamp) for the specified channel.
:FETCh:ARRay:VOLTage? (@<Channel>)Fetch Array Voltage. Returns the array of measured voltage data points from the last sweep for the specified channel.

MEASure (3 only on the B2902B)

CommandWhat it does
:MEASure:VOLTage? (@<Channel>)Measure Voltage. Triggers a measurement and returns the measured voltage of the specified channel in volts.
:MEASure:CURRent? (@<Channel>)Measure Current. Triggers a measurement and returns the measured current of the specified channel in amperes.
:MEASure:RESistance? (@<Channel>)Measure Resistance. Triggers a measurement and returns the measured resistance of the specified channel in ohms.

Control both from Python

With PyVISA and any VISA backend, this opens both instruments, identifies them, sends one setting, and reads one value from each. For the setting, the two libraries have no common command with a worked example on both, so each instrument uses its own: smua.source.output = smua.OUTPUT_ON on the 2602B and :OUTPut1 ON on the B2902B. For the reading, the two libraries have no common command with a worked example on both, so each instrument uses its own: print(smua.measure.v()) on the 2602B and :MEASure:VOLTage? (@1) on the B2902B. For the basics, see the PyVISA tutorial.

import pyvisa

rm = pyvisa.ResourceManager()
print(rm.list_resources())  # find both VISA addresses

a = rm.open_resource("PASTE_2602B_ADDRESS")  # Keithley 2602B
b = rm.open_resource("PASTE_B2902B_ADDRESS")  # Keysight B2902B
for inst in (a, b):
    inst.timeout = 5000  # ms
    print(inst.query("*IDN?"))

# No shared setting with an example on both, so each uses its own command
a.write("smua.source.output = smua.OUTPUT_ON")  # Turn On CHA
b.write(":OUTPut1 ON")  # Turn On

# No shared reading with an example on both, so each uses its own command
print(a.query("print(smua.measure.v())"))  # Measure Voltage CHA
print(b.query(":MEASure:VOLTage? (@1)"))  # Measure Voltage

a.close()
b.close()

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keithley 2602B or Keysight B2902B and writes the report from the measured results.

Get started

Frequently asked questions

What is the difference between the Keithley 2602B and the Keysight B2902B for remote control?

In TestFlow's library the 2602B has 69 TSP commands and the B2902B has 62 SCPI commands. 0 command headers are common to both, 52 are only on the 2602B (mostly smua and smub), and 58 are only on the B2902B (mostly SOURce and SENSe).

Can I use the same code for the Keithley 2602B and the Keysight B2902B?

Not directly. The 2602B uses TSP and the B2902B uses SCPI, so each command has to be rewritten for the other instrument. PyVISA opens both the same way, and both answer *IDN?, but the commands that set and read values differ.

Which has more remote commands, the 2602B or the B2902B?

The 2602B: 69 commands for the 2602B against 62 for the B2902B in TestFlow's library. Of those, 14 on the 2602B and 15 on the B2902B are queries that read a value or state, and the library splits them into 10 and 16 subsystems.

How do the 2602B and B2902B signal operation complete and report errors?

Only the 2602B library has an operation-complete command (waitcomplete()); the B2902B library has none. Only the 2602B library has an error-queue read (errorqueue.next()); the B2902B library has none. Each command named here is listed in the tables on this page and on each instrument's command reference.

Your next test, automated today

Describe the test. TestFlow builds the workflow, runs it on your instruments, and writes the report. See it on a bench like yours.