Function Generator · SCPI command reference

Stanford Research Systems DS345 SCPI commands

The Stanford Research Systems DS345 function generator is controlled remotely with SCPI commands. TestFlow's instrument library holds 29 commands for it, 6 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 DS345 on a real bench.

Commands
29
Queries
6
Subsystems
18
Models covered
1

Run this on your bench

Describe the test; TestFlow's agent uses this command set to drive your Stanford Research Systems DS345 and writes the report from the measured results.

Get started

Control the Stanford Research Systems DS345 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 Stanford Research Systems DS345's VISA address

# Paste the address of your Stanford Research Systems DS345 (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("FUNC 0")  # Set Function
print(inst.query("FUNC?"))  # Read Function

inst.close()

Run this on your bench

Describe the test; TestFlow's agent uses this command set to drive your Stanford Research Systems DS345 and writes the report from the measured results.

Get started

Run a DS345 test without writing code

Describe the test in a sentence, for example “set function on the DS345, then read function 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

29 commands in 18 groups. A ? marks a query that returns a value. Placeholders in angle brackets take the listed values.

Function (FUNCtion) (2)

CommandWhat it doesArguments
FUNC <Shape>Set Function. Sets the output function (0=Sine,1=Square,2=Triangle,3=Ramp,4=Noise,5=Arb).Number: 0,1,2,3,4,5
FUNC?Read Function. Reads the output function code.None

Frequency (FREQuency) (2)

CommandWhat it doesArguments
FREQ <Freq>Set Frequency. Sets the output frequency in Hz.Number
FREQ?Read Frequency. Reads the output frequency.None

AMPL subsystem (2)

CommandWhat it doesArguments
AMPL <Amp>VPSet Amplitude. Sets the output amplitude (append VP/VR/DB for units).Number
AMPL?Read Amplitude. Reads the output amplitude.None

OFFS subsystem (2)

CommandWhat it doesArguments
OFFS <Volt>Set Offset. Sets the DC offset voltage.Number
OFFS?Read Offset. Reads the DC offset voltage.None

MENA subsystem (2)

CommandWhat it doesArguments
MENA 1Enable Modulation. Enables modulation.None
MENA 0Disable Modulation. Disables modulation.None

PHSE subsystem (1)

CommandWhat it doesArguments
PHSE <Deg>Set Phase. Sets the output phase in degrees.Number

MTYP subsystem (1)

CommandWhat it doesArguments
MTYP <Type>Set Modulation Type. Sets the modulation type (0=Lin sweep,1=Log sweep,2=Internal AM,3=FM,4=PM,5=Burst).Number: 0,1,2,3,4,5

DPTH subsystem (1)

CommandWhat it doesArguments
DPTH <Pct>Set AM Depth. Sets the AM depth percentage.Number

FDEV subsystem (1)

CommandWhat it doesArguments
FDEV <Freq>Set FM Span. Sets the FM span/deviation in Hz.Number

SPAN subsystem (1)

CommandWhat it doesArguments
SPAN <Freq>Set Sweep Span. Sets the sweep span in Hz.Number

SPCF subsystem (1)

CommandWhat it doesArguments
SPCF <Freq>Set Sweep Center. Sets the sweep center frequency in Hz.Number

RATE subsystem (1)

CommandWhat it doesArguments
RATE <Freq>Set Sweep Rate. Sets the modulation/sweep rate in Hz.Number

BCNT subsystem (1)

CommandWhat it doesArguments
BCNT <N>Set Burst Count. Sets the burst count.Number

TSRC subsystem (1)

CommandWhat it doesArguments
TSRC <Src>Set Trigger Source. Sets the trigger source (0=Single,1=Internal,2=+ext,3=-ext,4=line).Number: 0,1,2,3,4

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 (7)

CommandWhat it doesArguments
*TRGTrigger Now. Issues a single trigger.None
*IDN?Identify. Returns the instrument identification string.None
*RSTReset. Resets the instrument to its default state.None
*CLSClear Status. Clears the status registers.None
*TST?Self Test. Runs the self-test and returns 0 for pass.None
*RCL <Slot>Recall Setting. Recalls a stored setting (0 to 9).Number
*SAV <Slot>Save Setting. Stores the current setting (0 to 9).Number

Where these commands come from

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

Frequently asked questions

Does the Stanford Research Systems DS345 support SCPI remote control?

Yes. The Stanford Research Systems DS345 accepts SCPI commands over its remote interfaces. TestFlow's instrument library holds 29 SCPI commands for it: 6 queries that read values or state, and 23 settings and actions.

How do I control the Stanford Research Systems DS345 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?, FUNC 0 and FUNC?.

Which command reads a value from the Stanford Research Systems DS345?

FUNC? (read function). Reads the output function code. The full list of queries is in the command reference on this page, grouped by subsystem.

Can I automate the Stanford Research Systems DS345 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 Stanford Research Systems DS345 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.