Function Generator · SCPI command comparison

Keysight 33522B vs Tektronix AFG31022: SCPI commands and remote control compared

In TestFlow's instrument library, the Keysight 33522B takes 123 SCPI commands, 17 of them queries, and the Tektronix AFG31022 takes 95 SCPI commands, 12 of them queries. That is 28 more on the 33522B. Counting distinct command headers (the command path without its arguments), 50 are accepted by both, 51 exist only on the 33522B, and 31 only on the AFG31022. 50% of the 33522B's command headers also exist on the AFG31022.

Both libraries have commands under SOURce, OUTPut, SYSTem, TRIGger, and DISPlay. Only the 33522B has ROSCillator and MMEMory.

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

TestFlow's library gives the 33612A the same command set as the 33522B, so the 33522B column applies to it too. 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.

33522B commands
123
AFG31022 commands
95
Shared headers
50
Unique headers
82

Run this on your bench

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

Get started

33522B 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.

Keysight 33522BTektronix AFG31022
Commands in TestFlow's library12395
Queries (read a value or state)1712
Settings and actions10683
Subsystems119
Distinct command headers10181
Headers the other lacks5131
Command languageSCPISCPI
Operation complete*OPC?*OPC?
Error queueSYSTem:ERRor?SYSTem:ERRor?
Models on this command set33522B, 33612AAFG31022, AFG3102C, AFG31052, AFG31102, AFG31152, AFG31252, AFG3252C

Commands both accept

50 command headers are in both libraries. Here are 12, taken across subsystems.

CommandWhat it does
SOURce<Channel>:FREQuency:MODE CWSet Frequency Mode Fixed. Sets the selected channel to fixed (continuous-wave) frequency mode.
OUTPut<Channel>:STATe ONTurn On Output. Enables the selected channel output.
SYSTem:BEEPer:STATe ONEnable Beeper. Enables the beeper.
*IDN?Identify. Returns the instrument identification string (manufacturer, model, serial, firmware).
SOURce<Channel>:VOLTage:UNIT <Unit>Set Voltage Unit. Sets the amplitude unit for the selected channel.
OUTPut<Channel>:STATe?Read Output State. Reads whether the selected channel output is on.
SYSTem:ERRor?Read Error. Reads and clears the next error-queue entry.
*RSTReset. Resets the instrument to its default state.
SOURce<Channel>:FUNCtion:RAMP:SYMMetry <Pct>Set Ramp Symmetry. Sets the ramp symmetry percentage (0 to 100) for the selected channel.
OUTPut<Channel>:POLarity NORMalSet Output Polarity Normal. Sets the selected channel output polarity to normal.
*CLSClear Status. Clears all event registers and the error queue.
SOURce<Channel>:AM:STATe ONEnable AM. Enables AM modulation on the selected channel.

Only on the Keysight 33522B

51 command headers in the 33522B library have no match in the AFG31022 library. Below are 16 of them from the 6 largest subsystems; the full list is in the Keysight 33522B command reference.

SOURce (37 only on the 33522B)

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

OUTPut (5 only on the 33522B)

CommandWhat it does
OUTPut<Channel>:LOAD <Ohm>Set Output Load. Sets the expected output load in ohms (1 to 10k) for the selected channel; use INF for high-Z.
OUTPut<Channel>:LOAD?Read Output Load. Reads the output load setting for the selected channel.
OUTPut<Channel>:POLarity?Read Output Polarity. Reads the selected channel output polarity.
OUTPut:SYNC:STATe ONTurn On Sync CH1. Enables the front-panel Sync output.

TRIGger (3 only on the 33522B)

CommandWhat it does
TRIGger:SOURce <Src>Set Trigger Source. Sets the trigger source.
TRIGger:SLOPe <Slope>Set Trigger Slope. Sets the external trigger slope.
TRIGgerTrigger Now. Issues an immediate trigger.

MMEMory (2 only on the 33522B)

CommandWhat it does
MMEMory:STORe:STATe <File>Save State. Stores the instrument state to a file.
MMEMory:LOAD:STATe <File>Load State. Loads an instrument state file.

SYSTem (2 only on the 33522B)

CommandWhat it does
SYSTem:BEEPerBeep Now. Sounds the beeper once.
SYSTem:VERSion?Read SCPI Version. Returns the SCPI version.

DISPlay (1 only on the 33522B)

CommandWhat it does
DISPlay ONEnable Display. Turns the front-panel display on.

Only on the Tektronix AFG31022

31 command headers in the AFG31022 library have no match in the 33522B library. Below are 11 of them from the 4 largest subsystems; the full list is in the Tektronix AFG31022 command reference.

SOURce (24 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.

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.

OUTPut (2 only on the AFG31022)

CommandWhat it does
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.

DISPlay (1 only on the AFG31022)

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

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 SOURce<Channel>:FREQuency:MODE (set frequency mode fixed), and the same line runs on each. 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_33522B_ADDRESS")  # Keysight 33522B
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 Frequency Mode Fixed
a.write("SOURce1:FREQuency:MODE CW")
b.write("SOURce1:FREQuency:MODE CW")

# 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 Keysight 33522B or Tektronix AFG31022 and writes the report from the measured results.

Get started

Frequently asked questions

What is the difference between the Keysight 33522B and the Tektronix AFG31022 for remote control?

In TestFlow's library the 33522B has 123 SCPI commands and the AFG31022 has 95 SCPI commands. 50 command headers are common to both, 51 are only on the 33522B (mostly SOURce and OUTPut), and 31 are only on the AFG31022 (mostly SOURce and TRIGger).

Can I use the same SCPI code for the Keysight 33522B and the Tektronix AFG31022?

Partly. 50 command headers are accepted by both, including SOURce<Channel>:FREQuency:MODE, OUTPut<Channel>:STATe, and SYSTem:BEEPer:STATe. 82 are not, for example SOURce<Channel>:FUNCtion on the 33522B 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 33522B or the AFG31022?

The 33522B: 123 commands for the 33522B against 95 for the AFG31022 in TestFlow's library. Of those, 17 on the 33522B and 12 on the AFG31022 are queries that read a value or state, and the library splits them into 11 and 9 subsystems.

How do the 33522B 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.