Function Generator · SCPI command comparison

Keithley 3390 vs Tektronix AFG31022: SCPI commands and remote control compared

In TestFlow's instrument library, the Keithley 3390 takes 88 SCPI commands, 10 of them queries, and the Tektronix AFG31022 takes 95 SCPI commands, 12 of them queries. That is 7 more on the AFG31022. Counting distinct command headers (the command path without its arguments), 12 are accepted by both, 62 exist only on the 3390, and 69 only on the AFG31022. 16% of the 3390's command headers also exist on the AFG31022.

Both libraries have commands under OUTPut, SYSTem, and TRIGger. Only the 3390 has VOLTage, FREQuency, APPLy, BURSt, FUNCtion, and AM and 6 more. Only the AFG31022 has SOURce and DISPlay.

Both libraries synchronise with *OPC?. Both libraries read errors with SYSTem:ERRor?.

TestFlow's library gives the AFG3102C, AFG31052, AFG31102, AFG31152, AFG31252, and AFG3252C the same command set as the AFG31022, so the AFG31022 column applies to them too.

3390 commands
88
AFG31022 commands
95
Shared headers
12
Unique headers
131

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keithley 3390 or Tektronix AFG31022 and writes the report from the measured results.

Get started

3390 vs AFG31022 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 3390Tektronix AFG31022
Commands in TestFlow's library8895
Queries (read a value or state)1012
Settings and actions7883
Subsystems199
Distinct command headers7481
Headers the other lacks6269
Command languageSCPISCPI
Operation complete*OPC?*OPC?
Error queueSYSTem:ERRor?SYSTem:ERRor?
Models on this command set3390AFG31022, AFG3102C, AFG31052, AFG31102, AFG31152, AFG31252, AFG3252C

Commands both accept

12 command headers are in both libraries. Where the AFG31022 library writes the command differently, its form is shown under the 3390's.

CommandWhat it does
OUTPut:POLarity NORMalAFG31022: OUTPut<Channel>:POLarity NORMalSet Output Polarity Normal. Sets output polarity to normal.
SYSTem:BEEPer:STATe ONEnable Beeper. Enables the beeper.
*IDN?Identify. Returns the instrument identification string (manufacturer, model, serial, firmware).
SYSTem:ERRor?Read Error. Reads and clears the next error-queue entry.
*RSTReset. Resets the instrument to its default state.
*CLSClear Status. Clears all event registers and the error queue.
*TST?Self Test. Runs the self-test and returns 0 for pass.
*OPC?Operation Complete. Returns 1 when all pending operations are complete.
*WAIWait To Continue. Waits until all pending operations are complete.
*TRGTrigger Bus. Generates a bus trigger.
*SAV <Slot>Save State Slot. Stores the current state to a memory slot (0 to 4).
*RCL <Slot>Recall State Slot. Recalls a state from a memory slot (0 to 4).

Only on the Keithley 3390

62 command headers in the 3390 library have no match in the AFG31022 library. Below are 24 of them from the 6 largest subsystems; the full list is in the Keithley 3390 command reference.

VOLTage (7 only on the 3390)

CommandWhat it does
VOLTage <Amp>Set Amplitude. Sets the output amplitude (Vpp).
VOLTage?Read Amplitude. Reads the output amplitude.
VOLTage:OFFSet <Volt>Set Voltage Offset. Sets the DC offset voltage.
VOLTage:OFFSet?Read Voltage Offset. Reads the DC offset voltage.

APPLy (6 only on the 3390)

CommandWhat it does
APPLy:SINusoid <Freq>,<Amp>,<Offset>Apply Sine. Sets sine with the given frequency, amplitude and offset.
APPLy:SQUare <Freq>,<Amp>,<Offset>Apply Square. Sets square with the given frequency, amplitude and offset.
APPLy:RAMP <Freq>,<Amp>,<Offset>Apply Ramp. Sets ramp with the given frequency, amplitude and offset.
APPLy:PULSe <Freq>,<Amp>,<Offset>Apply Pulse. Sets pulse with the given frequency, amplitude and offset.

FREQuency (6 only on the 3390)

CommandWhat it does
FREQuency <Freq>Set Frequency. Sets the output frequency in Hz.
FREQuency?Read Frequency. Reads the output frequency.
FREQuency:STARt <Freq>Set Sweep Start Freq. Sets the sweep start frequency.
FREQuency:STOP <Freq>Set Sweep Stop Freq. Sets the sweep stop frequency.

BURSt (5 only on the 3390)

CommandWhat it does
BURSt:STATe ONEnable Burst. Enables burst mode.
BURSt:MODE <Mode>Set Burst Mode. Sets the burst mode.
BURSt:NCYCles <N>Set Burst Cycles. Sets the number of cycles per burst.
BURSt:INTernal:PERiod <Sec>Set Burst Period. Sets the internal burst period.

FUNCtion (5 only on the 3390)

CommandWhat it does
FUNCtion <Shape>Set Function. Sets the output waveform shape.
FUNCtion?Read Function. Reads the output waveform shape.
FUNCtion:RAMP:SYMMetry <Pct>Set Ramp Symmetry. Sets the ramp symmetry percentage.
FUNCtion:SQUare:DCYCle <Pct>Set Square Duty Cycle. Sets the square-wave duty cycle percentage.

AM (4 only on the 3390)

CommandWhat it does
AM:STATe ONEnable AM. Enables AM modulation.
AM:DEPTh <Pct>Set AM Deviation. Sets the AM depth percentage.
AM:SOURce <Src>Set AM Source. Sets the AM modulation source.
AM:INTernal:FREQuency <Freq>Set AM Int Freq. Sets the internal AM modulating frequency.

Only on the Tektronix AFG31022

69 command headers in the AFG31022 library have no match in the 3390 library. Below are 14 of them from the 5 largest subsystems; the full list is in the Tektronix AFG31022 command reference.

SOURce (59 only on the AFG31022)

CommandWhat it does
SOURce<Channel>:FUNCtion:SHAPe <Shape>Set Function. Sets the output waveform shape for the selected channel.
SOURce<Channel>:FUNCtion:SHAPe?Read Function. Reads the output waveform shape for the selected channel.
SOURce<Channel>:FREQuency:FIXed <Freq>Set Frequency. Sets the output frequency in Hz for the selected channel.
SOURce<Channel>:FREQuency:FIXed?Read Frequency. Reads the output frequency for the selected channel.

OUTPut (4 only on the AFG31022)

CommandWhat it does
OUTPut<Channel>:STATe ONTurn On Output. Enables the selected channel output.
OUTPut<Channel>:STATe?Read Output State. Reads whether the selected channel output is on.
OUTPut<Channel>:IMPedance <Ohm>Set Output Impedance. Sets the the selected channel output load impedance in ohms (1 to 10k).
OUTPut<Channel>:IMPedance?Read Output Impedance. Reads the the selected channel output load impedance.

TRIGger (4 only on the AFG31022)

CommandWhat it does
TRIGger:SEQuence:SOURce <Src>Set Trigger Source. Sets the trigger source.
TRIGger:SEQuence:SLOPe <Slope>Set Trigger Slope. Sets the external trigger slope.
TRIGger:SEQuence:TIMer <Sec>Set Trigger Timer. Sets the internal trigger timer period.
TRIGger:SEQuence:IMMediateTrigger Now. Issues an immediate (manual) trigger.

DISPlay (1 only on the AFG31022)

CommandWhat it does
DISPlay:BRIGhtness <Level>Enable Display. Sets the display brightness (0 to 1).

IEEE 488.2 common (*) (1 only on the AFG31022)

CommandWhat it does
*OPT?Read Options. Queries the installed options.

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, both libraries hold OUTPut:POLarity (set output polarity normal); the AFG31022 library writes it as OUTPut1:POLarity NORMal. For the reading, both libraries hold SYSTem:ERRor? (read error), and the same line runs on each. 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_3390_ADDRESS")  # Keithley 3390
b = rm.open_resource("PASTE_AFG31022_ADDRESS")  # Tektronix AFG31022
for inst in (a, b):
    inst.timeout = 5000  # ms
    print(inst.query("*IDN?"))

# The same setting on both: Set Output Polarity Normal
a.write("OUTPut:POLarity NORMal")
b.write("OUTPut1:POLarity NORMal")

# The same reading on both: Read Error
print(a.query("SYSTem:ERRor?"))
print(b.query("SYSTem:ERRor?"))

a.close()
b.close()

Run this on your bench

Describe the test; TestFlow's agent uses these command sets to drive your Keithley 3390 or Tektronix AFG31022 and writes the report from the measured results.

Get started

Frequently asked questions

What is the difference between the Keithley 3390 and the Tektronix AFG31022 for remote control?

In TestFlow's library the 3390 has 88 SCPI commands and the AFG31022 has 95 SCPI commands. 12 command headers are common to both, 62 are only on the 3390 (mostly VOLTage and APPLy), and 69 are only on the AFG31022 (mostly SOURce and OUTPut).

Can I use the same SCPI code for the Keithley 3390 and the Tektronix AFG31022?

Partly. 12 command headers are accepted by both, including OUTPut:POLarity, SYSTem:BEEPer:STATe, and SYSTem:ERRor?. 131 are not, for example VOLTage on the 3390 and SOURce<Channel>:FUNCtion:SHAPe on the AFG31022, so a script that uses those needs a separate branch for each instrument.

Which has more remote commands, the 3390 or the AFG31022?

The AFG31022: 88 commands for the 3390 against 95 for the AFG31022 in TestFlow's library. Of those, 10 on the 3390 and 12 on the AFG31022 are queries that read a value or state, and the library splits them into 19 and 9 subsystems.

How do the 3390 and AFG31022 signal operation complete and report errors?

Both libraries synchronise with *OPC?. Both libraries read errors with SYSTem:ERRor?. 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.