Basic Information
Tektronix has released an official programming guide for the AFG1022 dual channel function generator, with the core goal of guiding users to achieve instrument automation control through SCPI (Standard Commands for Programmable Instruments), suitable for engineers who need to integrate AFG1022 into testing systems such as production line testing and laboratory automation.
Product core parameters: 2 independent channels, with a maximum bandwidth of 120MHz per channel, supporting 11 waveforms including sine wave, square wave, pulse wave, etc;
Supporting interfaces: GPIB (compliant with IEEE 488.2 standard), USB-TMC (USB 2.0 High Speed, compatible with USBTMC protocol);
Software compatibility: Supports mainstream VISA libraries such as TekVISA and NI-VISA, and can be called through programming languages such as Python, C #, LabVIEW, etc;
Document structure: Organized according to the sequence of "Command Fundamentals ->Function Control ->Interface Configuration ->Error Handling ->Appendix", containing a large number of command examples and code snippets.
SCPI Command Fundamentals (Programming Control Premiere)
1. Command structure and syntax rules
The SCPI command of AFG1022 adopts a hierarchical structure, separated by colons (:) to facilitate functional classification and memory. The core rules are as follows:
Example of Specific Explanation of Rule Categories
Hierarchical structure root command (e.g. SOURce)+sub command (e.g. FREQuency), channels can be omitted (default channel 1) Control channel 1 frequency: SOURce: FREQ 1000 (or SOURce: FREQ 1000); Control channel 2: SOURce2: FREQ 2000
Case sensitivity commands are not case sensitive, and parameter enumeration (such as ON/OFF) is also not sensitive: SOURce: WAVEform SIN is equivalent to: source: Waveform sin
The space rule allows for the addition of spaces between commands and parameters, as well as between parameters, without affecting parsing. SOURce: FREQ 1000 is equivalent to SOURce: FREQ 1000
The abbreviation rule command can use the first 3 characters for abbreviation (some commands support longer abbreviations): SOURce can be abbreviated as: SOU,: FREQuency can be abbreviated as: FRE
2. Command types and data formats
Command type:
Set command: used to configure instrument parameters, in the format of "command+parameter", with no return value;
Example: SOURce: VOLTage: AMPity 5 (set channel 1 amplitude to 5Vpp).
Query command: used to read the current parameters of the instrument, in the format of "command+question mark (?)", and return the corresponding value;
Example: SOURce: VOLTage: AMPlity? (Query the current amplitude of channel 1 and return "5.000000e+00").
Data format:
Example of Data Type Format Requirements
Numerical type supports integer (1000), decimal (1.234), Scientific notation (1e6) frequency setting: SOURCE: FREQ 1.234e6 (1.234MHz)
String type needs to be enclosed in double quotation marks ("), supporting letters, numbers, and special characters. Save settings: SYSTem: SETup: SAVE" MY_STUP1“
Enumeration type predefined options that require strict matching (case insensitive) waveform selection: SOURce: WAVEform SQUare, SOURce: WAVEform TRIangle

Core functional programming control (divided by functional modules)
1. Basic waveform generation and parameter control
AFG1022 supports 11 standard waveforms, and can select waveform types and configure core parameters (frequency, amplitude, DC offset, etc.) through SCPI commands. The parameter range and corresponding commands are as follows:
Function module core parameter range control command (channel 1 as an example) query command
11 types of waveform selection, including sine wave (SINusoid), square wave (SQUare), pulse wave (PULSe), etc.: SOURCE: WAVEform SINusoid: SOURCE: WAVEform?
Frequency setting output frequency: 0.1Hz~120MHz (sine wave/square wave); 0.1Hz~10MHz (pulse wave): SOURce: FREQuency 1000 (1kHz): SOURce: FREQuency?
Amplitude setting peak to peak amplitude of 10mVpp~20Vpp (50 Ω load); 20mVpp~40Vpp (high impedance load): SOURce: VOLTage: AMPlity 5 (5Vpp): SOURce: VOLTage: AMPlity?
DC offset DC offset voltage ± 10V (50 Ω load); ± 20V (high impedance load): SOURce: VOLTage: OFFset 2 (+2V): SOURce: VOLTage: OFFset?
Square wave duty cycle, such as wave height to level ratio of 10% to 90% (frequency ≤ 10MHz): SOURce: PULSe: DCYCle 50 (50%): SOURce: PULSe: DCYCle?
2. Advanced Function Control
(1) Modulation function (AM/FM/PM)
Support amplitude modulation (AM), frequency modulation (FM), phase modulation (PM), configurable modulation source (internal/external), modulation depth and other parameters:
Enable modulation: SOURce: MOD: STATe ON;
Select modulation type: SOURce: MOD: TYPE AM (AM modulation);
Configure internal modulation source frequency: SOURce: MOD: INTernal: FREQ 100 (100Hz modulation signal);
Configure AM modulation depth: SOURce: MOD: AM: DEPTh 50 (50% modulation depth).
(2) Trigger and synchronization
Supports internal triggering (continuous output), external triggering (controlled by external signals), and software triggering, suitable for synchronous multi device testing:
Email:wang@kongjiangauto.com