Function Generator · SCPI command reference

Tektronix AFG1022 and AFG1062 SCPI commands

The Tektronix AFG1022 and AFG1062 function generator is controlled remotely with SCPI commands. TestFlow's instrument library holds 67 commands for it, 10 of them queries that read values or state, grouped below by subsystem with their arguments. It is the same library TestFlow's AI agent uses to drive the AFG1022 on a real bench.

Commands
67
Queries
10
Subsystems
7
Models covered
2

Control the Tektronix AFG1022 from Python

With PyVISA, any VISA backend, and the instrument on USB, LAN or GPIB, this opens a session, identifies the instrument, sends one setting, and reads one value. Every command in it comes from the reference below. For a full walkthrough, see the PyVISA tutorial and the SCPI command cheat sheet.

import pyvisa

rm = pyvisa.ResourceManager()
print(rm.list_resources())  # find the Tektronix AFG1022's VISA address

# Paste the address of your Tektronix AFG1022 (USB, LAN or GPIB).
inst = rm.open_resource("PASTE_VISA_ADDRESS_HERE")
inst.timeout = 5000  # ms

print(inst.query("*IDN?"))  # identify the instrument
inst.write("OUTPut1:STATe ON")  # Turn On Output
print(inst.query("SYSTem:ERRor?"))  # Read Error

inst.close()

Run a AFG1022 test without writing code

Describe the test in a sentence, for example “turn on output on the AFG1022, then read error and log it against a limit”. TestFlow's agent builds the steps from this command library, runs them on your bench through the TestFlow desktop app, and writes the report from the measured values. See AI test automation for lab instruments for how that works and where it stops.

Get started

SCPI command reference

67 commands in 7 groups. A ? marks a query that returns a value. Placeholders in angle brackets take the listed values. The AFG1022 and AFG1062 share this command set in TestFlow's library.

Source (SOURce) (50)

CommandWhat it doesArguments
SOURce<Channel>:FUNCtion:SHAPe <Shape>Set Function. Sets the output waveform shape for the selected channel.Number: 1,2; Text: SINusoid,SQUare,PULSe,RAMP,PRNoise,DC,Sinc,Gauss,Lorentz,ExpRise,ExpDecay,HaverSine,EMEMory,EFILe
SOURce<Channel>:FUNCtion:SHAPe?Read Function. Reads the output waveform shape for the selected channel.Number: 1,2
SOURce<Channel>:FREQuency:FIXed <Freq>Set Frequency. Sets the output frequency in Hz for the selected channel.Number: 1,2; Number
SOURce<Channel>:FREQuency:FIXed?Read Frequency. Reads the output frequency for the selected channel.Number: 1,2
SOURce<Channel>:FREQuency:MODE CWSet Frequency Mode CW. Sets the selected channel frequency mode to continuous wave.Number: 1,2
SOURce<Channel>:FREQuency:MODE SWEepSet Frequency Mode Sweep. Sets the selected channel frequency mode to sweep.Number: 1,2
SOURce<Channel>:FREQuency:STARt <Freq>Set Frequency Start. Sets the sweep start frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:FREQuency:STOP <Freq>Set Frequency Stop. Sets the sweep stop frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:FREQuency:CENTer <Freq>Set Frequency Center. Sets the sweep center frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:FREQuency:SPAN <Freq>Set Frequency Span. Sets the sweep frequency span for the selected channel.Number: 1,2; Number
SOURce<Channel>:PHASe:ADJust <Deg>Set Phase. Sets the phase in degrees for the selected channel.Number: 1,2; Number
SOURce<Channel>:PHASe:ADJust?Read Phase. Reads the phase for the selected channel.Number: 1,2
SOURce<Channel>:VOLTage:LEVel:IMMediate:AMPLitude <Amp>Set Amplitude. Sets the output amplitude for the selected channel.Number: 1,2; Number
SOURce<Channel>:VOLTage:LEVel:IMMediate:AMPLitude?Read Amplitude. Reads the output amplitude for the selected channel.Number: 1,2
SOURce<Channel>:VOLTage:LEVel:IMMediate:OFFSet <Volt>Set Voltage Offset. Sets the DC offset voltage for the selected channel.Number: 1,2; Number
SOURce<Channel>:VOLTage:LEVel:IMMediate:OFFSet?Read Voltage Offset. Reads the DC offset voltage for the selected channel.Number: 1,2
SOURce<Channel>:PULSe:DCYCle <Pct>Set Pulse Duty Cycle. Sets the pulse duty cycle percentage for the selected channel.Number: 1,2; Number
SOURce<Channel>:AM:STATe ONEnable AM. Enables AM modulation on the selected channel.Number: 1,2
SOURce<Channel>:AM:STATe OFFDisable AM. Disables AM modulation on the selected channel.Number: 1,2
SOURce<Channel>:AM:DEPTh <Pct>Set AM Deviation. Sets the AM depth percentage for the selected channel.Number: 1,2; Number
SOURce<Channel>:AM:SOURce <Src>Set AM Source. Sets the AM modulation source for the selected channel.Number: 1,2; Text: INTernal,EXTernal
SOURce<Channel>:AM:INTernal:FREQuency <Freq>Set AM Int Freq. Sets the internal AM modulating frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:AM:INTernal:FUNCtion <Shape>Set AM Int Function. Sets the internal AM modulating waveform for the selected channel.Number: 1,2; Text: SINusoid,SQUare,RAMP,PRNoise
SOURce<Channel>:FM:STATe ONEnable FM. Enables FM modulation on the selected channel.Number: 1,2
SOURce<Channel>:FM:STATe OFFDisable FM. Disables FM modulation on the selected channel.Number: 1,2
SOURce<Channel>:FM:DEViation <Freq>Set FM Deviation. Sets the FM frequency deviation in Hz for the selected channel.Number: 1,2; Number
SOURce<Channel>:FM:SOURce <Src>Set FM Source. Sets the FM modulation source for the selected channel.Number: 1,2; Text: INTernal,EXTernal
SOURce<Channel>:FM:INTernal:FREQuency <Freq>Set FM Int Freq. Sets the internal FM modulating frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:FM:INTernal:FUNCtion <Shape>Set FM Int Function. Sets the internal FM modulating waveform for the selected channel.Number: 1,2; Text: SINusoid,SQUare,RAMP,PRNoise
SOURce<Channel>:PM:STATe ONEnable PM. Enables PM modulation on the selected channel.Number: 1,2
SOURce<Channel>:PM:STATe OFFDisable PM. Disables PM modulation on the selected channel.Number: 1,2
SOURce<Channel>:PM:DEViation <Deg>Set PM Deviation. Sets the PM phase deviation in degrees for the selected channel.Number: 1,2; Number
SOURce<Channel>:PM:SOURce <Src>Set PM Source. Sets the PM modulation source for the selected channel.Number: 1,2; Text: INTernal,EXTernal
SOURce<Channel>:PM:INTernal:FREQuency <Freq>Set PM Int Freq. Sets the internal PM modulating frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:PM:INTernal:FUNCtion <Shape>Set PM Int Function. Sets the internal PM modulating waveform for the selected channel.Number: 1,2; Text: SINusoid,SQUare,RAMP,PRNoise
SOURce<Channel>:FSKey:STATe ONEnable FSK. Enables FSK modulation on the selected channel.Number: 1,2
SOURce<Channel>:FSKey:STATe OFFDisable FSK. Disables FSK modulation on the selected channel.Number: 1,2
SOURce<Channel>:FSKey:FREQuency <Freq>Set FSK Hop Freq. Sets the FSK hop frequency for the selected channel.Number: 1,2; Number
SOURce<Channel>:FSKey:INTernal:RATE <Rate>Set FSK Rate. Sets the FSK internal rate for the selected channel.Number: 1,2; Number
SOURce<Channel>:FSKey:SOURce <Src>Set FSK Source. Sets the FSK source for the selected channel.Number: 1,2; Text: INTernal,EXTernal
SOURce<Channel>:PWM:STATe ONEnable PWM. Enables PWM on the selected channel.Number: 1,2
SOURce<Channel>:PWM:STATe OFFDisable PWM. Disables PWM on the selected channel.Number: 1,2
SOURce<Channel>:PWM:DEViation:DCYCle <Pct>Set PWM Deviation. Sets the PWM duty-cycle deviation for the selected channel.Number: 1,2; Number
SOURce<Channel>:PWM:SOURce <Src>Set PWM Source. Sets the PWM source for the selected channel.Number: 1,2; Text: INTernal,EXTernal
SOURce<Channel>:SWEep:TIME <Sec>Set Sweep Time. Sets the sweep time for the selected channel.Number: 1,2; Number
SOURce<Channel>:SWEep:SPACing <Type>Set Sweep Spacing. Sets the sweep spacing for the selected channel.Number: 1,2; Text: LINear,LOGarithmic
SOURce<Channel>:BURSt:STATe ONEnable Burst. Enables burst mode on the selected channel.Number: 1,2
SOURce<Channel>:BURSt:STATe OFFDisable Burst. Disables burst mode on the selected channel.Number: 1,2
SOURce<Channel>:BURSt:MODE <Mode>Set Burst Mode. Sets the burst mode for the selected channel.Number: 1,2; Text: TRIGgered,GATed
SOURce<Channel>:BURSt:NCYCles <N>Set Burst Cycles. Sets the number of cycles per burst for the selected channel.Number: 1,2; Number

Output (OUTPut) (5)

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

System (SYSTem) (1)

CommandWhat it doesArguments
SYSTem:ERRor?Read Error. Reads and clears the next error-queue entry.None

Other subsystem (1)

CommandWhat it doesArguments
<Output Variable>=<Equation>Math. Variable equals an equation like (${Var_name}= ${Var_name}/2)Number; Text

WAIT subsystem (1)

CommandWhat it doesArguments
wait(<ms>)Wait. Waits for number of millisecondsNumber

SAVE subsystem (1)

CommandWhat it doesArguments
save2var <Variable_name>Save2Variable. Saves last measurement to a variableText

IEEE 488.2 common commands (8)

CommandWhat it doesArguments
*TRGTrigger Now. Issues an immediate (manual) trigger.None
*IDN?Identify. Returns the instrument identification string (manufacturer, model, serial, firmware).None
*RSTReset. Resets the instrument to its default state.None
*CLSClear Status. Clears all event registers and the error queue.None
*WAIWait To Continue. Waits until all pending operations are complete.None
*SAV <Slot>Save State Slot. Stores the current state to a setup memory slot (0 to 4).Number
*RCL <Slot>Recall State Slot. Recalls a state from a setup memory slot (0 to 4).Number
*OPT?Read Options. Queries the installed options.None

Where these commands come from

This reference is generated from TestFlow's instrument library, which is drafted from Tektronix's programming documentation for the AFG1022 and AFG1062 and checked when the agent runs it. Ranges, timing, and option-dependent commands are defined by Tektronix's programming manual: check it before you rely on an edge case. Last updated November 17, 2026.

Frequently asked questions

Does the Tektronix AFG1022 support SCPI remote control?

Yes. The Tektronix AFG1022 accepts SCPI commands over its remote interfaces. TestFlow's instrument library holds 67 SCPI commands for it: 10 queries that read values or state, and 57 settings and actions.

How do I control the Tektronix AFG1022 from Python?

Install PyVISA and a VISA backend, find the instrument's address with ResourceManager().list_resources(), open it, then send commands with write() and read values with query(). The example on this page sends *IDN?, OUTPut1:STATe ON and SYSTem:ERRor?.

Which command reads a value from the Tektronix AFG1022?

SYSTem:ERRor? (read error). Reads and clears the next error-queue entry. The full list of queries is in the command reference on this page, grouped by subsystem.

Can I automate the Tektronix AFG1022 without writing code?

Yes. TestFlow is an AI agent for electronics testing: you describe the test, and it builds the automation from this command library, runs it on the Tektronix AFG1022 through the TestFlow desktop app, and writes the report from the measured results.

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.