Function Generator · SCPI command comparison

Siglent SDG2042X vs Tektronix AFG31022: SCPI commands and remote control compared

In TestFlow's instrument library, the Siglent SDG2042X takes 77 SCPI commands, 9 of them queries, and the Tektronix AFG31022 takes 95 SCPI commands, 12 of them queries. That is 18 more on the AFG31022. Counting distinct command headers (the command path without its arguments), 10 are accepted by both, 16 exist only on the SDG2042X, and 71 only on the AFG31022. 38% of the SDG2042X's command headers also exist on the AFG31022.

Only the SDG2042X has C, COUP, ROSC, BUZZ, and SCSV. Only the AFG31022 has SOURce, OUTPut, TRIGger, SYSTem, and DISPlay.

Both libraries synchronise with *OPC?. Only the AFG31022 library has an error-queue read (SYSTem:ERRor?); the SDG2042X library has none.

TestFlow's library gives the SDG6022X the same command set as the SDG2042X, so the SDG2042X 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.

SDG2042X commands
77
AFG31022 commands
95
Shared headers
10
Unique headers
87

Run this on your bench

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

Get started

SDG2042X 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.

Siglent SDG2042XTektronix AFG31022
Commands in TestFlow's library7795
Queries (read a value or state)912
Settings and actions6883
Subsystems99
Distinct command headers2681
Headers the other lacks1671
Command languageSCPISCPI
Operation complete*OPC?*OPC?
Error queueNot in librarySYSTem:ERRor?
Models on this command setSDG2042X, SDG6022XAFG31022, AFG3102C, AFG31052, AFG31102, AFG31152, AFG31252, AFG3252C

Commands both accept

10 command headers are in both libraries.

CommandWhat it does
*IDN?Identify. Returns the instrument identification string (manufacturer, model, serial, firmware).
*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.
*RCL <Slot>Recall State Slot. Recalls a state from a memory slot.
*OPT?Read Options. Queries the installed options.

Only on the Siglent SDG2042X

16 command headers in the SDG2042X library have no match in the AFG31022 library. Below are 8 of them from the 5 largest subsystems; the full list is in the Siglent SDG2042X command reference.

C (12 only on the SDG2042X)

CommandWhat it does
C<Channel>:OUTP ONTurn On Output. Enables the selected channel output.
C<Channel>:OUTP?Read Output State. Reads the selected channel output state and settings.
C<Channel>:BSWV WVTP,<Shape>Set Function. Sets the basic waveform type for the selected channel.
C<Channel>:BSWV?Read Basic Waveform. Reads all basic-waveform parameters for the selected channel.

BUZZ (1 only on the SDG2042X)

CommandWhat it does
BUZZ ONBuzzer On. Enables the buzzer.

COUP (1 only on the SDG2042X)

CommandWhat it does
COUP TRACE,ONEnable Channel Coupling. Enables channel tracking/coupling.

ROSC (1 only on the SDG2042X)

CommandWhat it does
ROSC INTSet Clock Internal. Uses the internal reference clock.

SCSV (1 only on the SDG2042X)

CommandWhat it does
SCSV <Minutes>Screen Save On. Enables the screen saver.

Only on the Tektronix AFG31022

71 command headers in the AFG31022 library have no match in the SDG2042X library. Below are 15 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 (5 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.

SYSTem (2 only on the AFG31022)

CommandWhat it does
SYSTem:ERRor?Read Error. Reads and clears the next error-queue entry.
SYSTem:BEEPer:STATe ONEnable Beeper. Enables the beeper.

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, the two libraries have no common command with a worked example on both, so each instrument uses its own: C1:OUTP ON on the SDG2042X and SOURce:ROSCillator:SOURce INTernal on the AFG31022. For the reading, both libraries hold *TST? (self test), 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_SDG2042X_ADDRESS")  # Siglent SDG2042X
b = rm.open_resource("PASTE_AFG31022_ADDRESS")  # Tektronix AFG31022
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("C1:OUTP ON")  # Turn On Output
b.write("SOURce:ROSCillator:SOURce INTernal")  # Set Clock Internal

# The same reading on both: Self Test
print(a.query("*TST?"))
print(b.query("*TST?"))

a.close()
b.close()

Run this on your bench

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

Get started

Frequently asked questions

What is the difference between the Siglent SDG2042X and the Tektronix AFG31022 for remote control?

In TestFlow's library the SDG2042X has 77 SCPI commands and the AFG31022 has 95 SCPI commands. 10 command headers are common to both, 16 are only on the SDG2042X (mostly C and BUZZ), and 71 are only on the AFG31022 (mostly SOURce and OUTPut).

Can I use the same SCPI code for the Siglent SDG2042X and the Tektronix AFG31022?

Partly. 10 command headers are accepted by both. 87 are not, for example C<Channel>:OUTP on the SDG2042X 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 SDG2042X or the AFG31022?

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

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

Both libraries synchronise with *OPC?. Only the AFG31022 library has an error-queue read (SYSTem:ERRor?); the SDG2042X 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.