Function Generator · SCPI command comparison

Rigol DG1022Z vs Tektronix AFG1022: SCPI commands and remote control compared

In TestFlow's instrument library, the Rigol DG1022Z takes 201 SCPI commands, 49 of them queries, and the Tektronix AFG1022 takes 67 SCPI commands, 10 of them queries. That is 134 more on the DG1022Z. Counting distinct command headers (the command path without its arguments), 38 are accepted by both, 142 exist only on the DG1022Z, and 18 only on the AFG1022. 21% of the DG1022Z's command headers also exist on the AFG1022.

Both libraries have commands under SOURce, OUTPut, and SYSTem. Only the DG1022Z has COUNter, DISPlay, COUPling, MMEMory, ROSCillator, and HCOPy and 1 more.

Only the DG1022Z library has an operation-complete command (*OPC?); the AFG1022 library has none. Both libraries read errors with SYSTem:ERRor?.

TestFlow's library gives the DG1032Z the same command set as the DG1022Z, so the DG1022Z column applies to it too. TestFlow's library gives the AFG1062 the same command set as the AFG1022, so the AFG1022 column applies to it too.

DG1022Z commands
201
AFG1022 commands
67
Shared headers
38
Unique headers
160

Run this on your bench

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

Get started

DG1022Z vs AFG1022 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.

Rigol DG1022ZTektronix AFG1022
Commands in TestFlow's library20167
Queries (read a value or state)4910
Settings and actions15257
Subsystems147
Distinct command headers18056
Headers the other lacks14218
Command languageSCPISCPI
Operation complete*OPC?Not in library
Error queueSYSTem:ERRor?SYSTem:ERRor?
Models on this command setDG1022Z, DG1032ZAFG1022, AFG1062

Commands both accept

38 command headers are in both libraries. Here are 12, taken across subsystems. Where the AFG1022 library writes the command differently, its form is shown under the DG1022Z's.

CommandWhat it does
:SOURce1:AM:STATe ONAFG1022: SOURce<Channel>:AM:STATe ONEnable AM. Enables amplitude modulation on channel 1.
:OUTPut1:STATe ONAFG1022: OUTPut<Channel>:STATe ONTurn On Output. Enables the output of channel 1.
:SYSTem:ERRor?Read Error. Reads and removes the next error from the error queue.
*SAV <Location>AFG1022: *SAV <Slot>Save State. Stores the current instrument state or arbitrary waveform to an internal location.
:SOURce1:AM:SOURce <Source>AFG1022: SOURce<Channel>:AM:SOURce <Src>Set AM Source. Sets the AM modulation source to internal or external.
:OUTPut1:STATe?AFG1022: OUTPut<Channel>:STATe?Read Output State. Reads whether channel 1 output is ON or OFF.
*RCL <Location>AFG1022: *RCL <Slot>Recall State. Recalls a state or arbitrary waveform from an internal location.
:SOURce1:AM:INTernal:FREQuency <Freq>AFG1022: SOURce<Channel>:AM:INTernal:FREQuency <Freq>Set AM Mod Frequency. Sets the internal AM modulating frequency in Hz.
:OUTPut1:IMPedance <Ohm>AFG1022: OUTPut<Channel>:IMPedance <Ohm>Set Output Impedance. Sets the output load impedance in ohms (1 to 10k) or INFinity for HighZ.
*IDN?Identify. Returns the instrument identification string (manufacturer model serial firmware).
:SOURce1:AM:INTernal:FUNCtion <Name>AFG1022: SOURce<Channel>:AM:INTernal:FUNCtion <Shape>Set AM Mod Waveform. Sets the internal AM modulating waveform.
:OUTPut1:IMPedance?AFG1022: OUTPut<Channel>:IMPedance?Read Output Impedance. Reads the current output load impedance setting.

Only on the Rigol DG1022Z

142 command headers in the DG1022Z library have no match in the AFG1022 library. Below are 24 of them from the 6 largest subsystems; the full list is in the Rigol DG1022Z command reference.

SOURce (99 only on the DG1022Z)

CommandWhat it does
:SOURce1:APPLy:SINusoid <Freq>,<Amp>,<Offset>Apply Sine. Configures channel 1 to output a sine waveform with the given frequency amplitude and offset.
:SOURce1:APPLy:SQUare <Freq>,<Amp>,<Offset>Apply Square. Configures channel 1 to output a square waveform with the given frequency amplitude and offset.
:SOURce1:APPLy:RAMP <Freq>,<Amp>,<Offset>Apply Ramp. Configures channel 1 to output a ramp waveform with the given frequency amplitude and offset.
:SOURce1:APPLy:PULSe <Freq>,<Amp>,<Offset>Apply Pulse. Configures channel 1 to output a pulse waveform with the given frequency amplitude and offset.

OUTPut (10 only on the DG1022Z)

CommandWhat it does
:OUTPut1:POLarity NORMalSet Output Polarity Normal. Sets the output polarity of channel 1 to normal.
:OUTPut1:POLarity?Read Output Polarity. Reads the current output polarity of channel 1.
:OUTPut1:MODE <Mode>Set Output Mode. Sets the output mode of channel 1 to normal or gated.
:OUTPut1:MODE?Read Output Mode. Reads the current output mode of channel 1.

COUNter (8 only on the DG1022Z)

CommandWhat it does
:COUNter:STATe ONEnable Counter. Enables the frequency counter function.
:COUNter:STATe?Read Counter State. Reads the running status of the frequency counter.
:COUNter:MEASure?Read Counter Measurement. Reads the frequency period duty cycle and pulse width measured by the counter.
:COUNter:COUPling <Mode>Set Counter Coupling. Sets the input coupling of the frequency counter.

DISPlay (6 only on the DG1022Z)

CommandWhat it does
:DISPlay:BRIGhtness <Level>Set Display Brightness. Sets the screen brightness level (1 to 100).
:DISPlay:BRIGhtness?Read Display Brightness. Reads the current screen brightness.
:DISPlay:MODE <Mode>Set Display Mode. Sets the display mode to dual parameter dual graph or single channel.
:DISPlay:TEXT <Str>Set Display Text. Displays a text string on the instrument screen.

IEEE 488.2 common (*) (6 only on the DG1022Z)

CommandWhat it does
*OPC?Operation Complete. Returns 1 when all pending operations are complete.
*OPCSet Operation Complete Bit. Sets the operation complete bit after all previous commands are executed.
*ESE <Value>Set Event Status Enable. Sets the standard event status enable register.
*ESR?Read Event Status. Reads and clears the standard event status register.

MMEMory (5 only on the DG1022Z)

CommandWhat it does
:MMEMory:STORe:STATe <File>Store State To File. Stores the current instrument state to a file on external memory.
:MMEMory:LOAD:STATe <File>Load State From File. Loads an instrument state file from external memory.
:MMEMory:CATalog?List Directory. Returns the files and folders in the current external memory directory.
:MMEMory:CDIRectory <Path>Set Directory. Sets the current working directory on external memory.

Only on the Tektronix AFG1022

18 command headers in the AFG1022 library have no match in the DG1022Z library. Below are 4 of them from the 1 largest subsystem; the full list is in the Tektronix AFG1022 command reference.

SOURce (18 only on the AFG1022)

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.

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 :OUTPut1:STATe (turn on output), and the same line runs on each. For the reading, both libraries hold :OUTPut1:STATe? (read output state), 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_DG1022Z_ADDRESS")  # Rigol DG1022Z
b = rm.open_resource("PASTE_AFG1022_ADDRESS")  # Tektronix AFG1022
for inst in (a, b):
    inst.timeout = 5000  # ms
    print(inst.query("*IDN?"))

# The same setting on both: Turn On Output
a.write(":OUTPut1:STATe ON")
b.write("OUTPut1:STATe ON")

# The same reading on both: Read Output State
print(a.query(":OUTPut1:STATe?"))
print(b.query("OUTPut1:STATe?"))

a.close()
b.close()

Run this on your bench

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

Get started

Frequently asked questions

What is the difference between the Rigol DG1022Z and the Tektronix AFG1022 for remote control?

In TestFlow's library the DG1022Z has 201 SCPI commands and the AFG1022 has 67 SCPI commands. 38 command headers are common to both, 142 are only on the DG1022Z (mostly SOURce and OUTPut), and 18 are only on the AFG1022 (mostly SOURce).

Can I use the same SCPI code for the Rigol DG1022Z and the Tektronix AFG1022?

Partly. 38 command headers are accepted by both, including :SOURce1:AM:STATe, :OUTPut1:STATe, and :SYSTem:ERRor?. 160 are not, for example :SOURce1:APPLy:SINusoid on the DG1022Z and SOURce<Channel>:FUNCtion:SHAPe on the AFG1022, so a script that uses those needs a separate branch for each instrument.

Which has more remote commands, the DG1022Z or the AFG1022?

The DG1022Z: 201 commands for the DG1022Z against 67 for the AFG1022 in TestFlow's library. Of those, 49 on the DG1022Z and 10 on the AFG1022 are queries that read a value or state, and the library splits them into 14 and 7 subsystems.

How do the DG1022Z and AFG1022 signal operation complete and report errors?

Only the DG1022Z library has an operation-complete command (*OPC?); the AFG1022 library has none. 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.