Computers communicate with the P4120 - 4165 series generator by sending and
receiving commands over USB or RS232 interface. Command is sent and identified in the
form of ASCII character strings for users to easily control the generator and do
user-defined development. Operations that you can do with a computer and a generator
include: Set the generator and output waveforms from the generator.
Connection: Please connect the USB Device port at the rear panel of the generator with
the corresponding USB interface on the computer using an USB cable, or connect the
RS232 port at the rear panel of the generator with the corresponding RS232 interface on
the computer using an RS232 cable.
1.2. Command Syntax
The command systems of this series present a hierarchy structure (tree system) and each
command consists of a “Root” keyword and one or multiple sub-keywords. The keywords
are separated by ":" and are followed by the parameter settings available, "?" is added at
the end of the command string to indicate query and the command and parameter are
separated by "space".
For example,
:FUNCtion:SQUare:DTYCycle {<percent> }
:FUNCtion:SQUare:DTYCycle?
FUNCtion is the root keyword of the command, SQUare and DTYCycle are the
second-level and third-level keywords respectively, all the keywords are separated by “:”.
<percent> denotes the parameter that users can set, the default unit of the numerical
parameters are listed in Appendix
FUNCtion:SQUare:DTYCycle and parameter are separated by “space”. All the command
strings begin with ":" or "*" and have no terminator ("\n" or "\r \n" can be recognized as
terminator also). The commands can be sent continuously (have command execution
queue), the program will be executed in sequence. If the command is correct, "->\n" will
be returned; if wrong, "=?\n" will be returned. If the parameter is invalid or the command
Ⅰ
; “?” denotes query; the command
1
does not work, "NULL\n" will be returned.
After one of the complete commands, if the following command has the same first-level
keyword or the same first-level and second-level keywords (keywords have 3 levels most),
the same keywords in the following command can be omit, the command can be written
as the rest parts.
E.g.
:func:sine:freq 1000 //Complete command
:ampl 2 //Omit first-level func and second-level sine
:squ:offset 1 //Omit first-level func
1.3. Symbol Description
Following symbols are usually used to assist to explain the parameters contained in a
command.
a) Braces { }
The options enclosed in a { } are parameters available in the command. Only one
option could be selected every time, and all the options are separated by “|”. For
example, {ON|OFF} indicateds that ON or OFF can be selected.
b) Triangle Brackets < >
The parameter enclosed in < > must be replaced by an effective value.
For example,
:FUNCtion:SINE:FREQuency <value>
wherein, <value> must be a numerical value, such as:
:FUNCtion:SINE:FREQuency 1000
1.4. Programmed Parameter Type
The commands contain 5 kinds of parameters, different parameters have different setting
methods.
2
a) Boolean Parameters
The parameters could be “OFF” or “ON” (“0” or “1”), for example,
:CHANnel:CH1 {OFF|ON}
“OFF” denotes disabling the output of CH1. “On” denotes enabling the output of CH1.
b) Consecutive Integer Parameters
The parameters could be a consecutive integer, for example,
:FUNCtion:ARB:BUILtinwform <value>
<value> could be any integer between 0 and 25(including 0 and 25).
c) Consecutive Real Number Parameters
The parameters could be any value within the effective range and with the required
precision, for example,
FREQuency {<frequency>}
For sine wave, <frequency> could be any real number between 1uHz and 25MHz.
d) ASCII Character String
The parameters should be the combinations of ASCII characters, for example,
:AM:SOURce <modulation signal source>
<modulation signal source> is a character string defined inside.
1.5. Command Abbreviation
All the commands are case-insensitive, so you can use any kind of them. But if
abbreviation is used, all the capital letters specified in commands must be written
completely. For example,
FUNCtion:SQUare:AMPLitude? also can be:
FUNC:SQU:AMPL? or func:squ:ampl? or fUnC:sQu:AmPL?
3
1.6. Available Command for Different Model
Note: Not every model of this series has the same functions, as for example some
entry-level devices do not have any modulation modes. So all SCPI command for these
(not integrated) functions will not work and are invalid. For models without frequency
counter, all command for the counter are invalid.
4
1. *IDN
Syntax
*IDN?
Function
Query ID character string of instrument.
Explanations
The query returns 4 character segments separated by commas “,”:
manufacturer, model, serial number and the edition number.
Query/set the waveform function for current channel.
Explanations
This command work on the current selected channel by default. If you
want to set the other channel, you need switch channel first (refer to the
command of channel control, such as CHANnel CH2).
Query/set the frequency of output function for current channel.
Explanations
<frequency> is the frequency set by user, the default unit is Hz. NOISE does
not have frequency parameter. The query returns the frequency set in scientific
notation, such as: 1.000000E+04。
Query/set the duty cycle of square/pulse wave for current channel.
Explanations
<percent> is the percent of duty cycle set by users, the default unit is %.
Example
:FUNCtion:SQUare:DTYCycle 20 sets the duty cycle of square wave as
20%
10. :FUNCtion:RAMP:SYMMetry
Syntax
:FUNCtion:RAMP:SYMMetry?
:FUNCtion:RAMP:SYMMetry {<symmetry>}
Function
Query/set the symmetry of ramp wave for current channel.
Explanations
<symmetry> is the percent of symmetry set by users, the default unit is %.
9
Example
:FUNCtion:RAMP:SYMMetry 20 sets the symmetry of ramp wave as 20%
11. :FUNCtion:PULSe:WIDTh
Syntax
:FUNCtion:PULSe:WIDTh?
:FUNCtion:PULSe:WIDTh {<width>}
Function
Query/set the width of pulse wave for current channel.
Explanations
<width> is the width set by users, the default unit is S.
Example
:FUNCtion:PULSe:WIDTh 1.0E-04 sets the width of pulse wave as 100μs
12. :FUNCtion:ARB:BUILtinwform
Syntax
:FUNCtion:ARB:BUILtinwform?
:FUNCtion:ARB:BUILtinwform {<name of build-in wave>|<number of
build-in wave>}
Function
Query/set the build-in arbitrary wave for current channel.
Explanations
<name of build-in wave> is listed in AppendixⅠ. <number of build-in
wave> is an integer between 0 and 25 corresponding to <name of build-in
wave>.
The query returns <name of build-in wave>,<number of build-in wave>.
Example
:FUNCtion:ARB:BUILtinwform ExpRise sets the arbitrary wave as
Exponential Rise waveform
:FUNCtion:ARB:BUILtinwform? Returns x^2,15 (if the output arbitrary
wave is selected from the file data stored in flash, the query returns NULL).
10
13. :FUNCtion:ARB:FILE
Syntax
:FUNCtion:ARB:FILE?
:FUNCtion:ARB:FILE {<file name>}
Function
Query/read the data file of arbitrary wave stored in the root directory of
flash for current channel.
Explanations
If the arbitrary wave is selected as the data file stored in flash, the query
returns the name of data file; read outputs the wave stored in flash with the
name <file name>.
Example
:FUNCtion:ARB:FILE 999.bin sets the arbitrary wave as 999.bin in flash.
:FUNCtion:ARB:FILE? returns 999.bin
14. :FUNCtion:DC:VOLTage
Syntax
:FUNCtion:DC:VOLTage?
:FUNCtion:DC:VOLTage {<voltage>}
Function
Query/set the DC voltage for current channel
Explanations
<voltage> is the voltage set by users, the default unit is V.
This command is only for P4125.
Example
:FUNCtion:DC:VOLTage -2 sets the DC voltage as -2V.
Query/set the internal modulating wave of {AM|FM|PM|PWM}
Explanations
In internal modulation mode, the modulating wave could be sine, square,
ramp, noise or arbitrary wave, the default is sine. Noise cannot be set for
PWM
Example
:FUNCtion:AM:SHAPe SQU sets the modulating wave of AM as square.
Query/set internal or external modulation source of
{AM|FM|PM|FSK|PWM}
Explanations
Example
:FUNCtion:AM:SOURce EXT sets the modulation source of AM as
external.
19. :FUNCtion:FM:DEViation
Syntax
:FUNCtion:FM:DEViation?
:FUNCtion:FM:DEViation {<frequency deviation>}
Function
Query/set the frequency deviation of FM.
Explanations
The unit of <frequency deviation> is Hz.
Example
:FUNCtion:FM:DEViation 100 sets the frequency deviation of FM as 100Hz
20. :FUNCtion:PM:PHASe
Syntax
:FUNCtion:PM:PHASe?
:FUNCtion:PM:PHASe {<phase deviation>}
Function
Query/set the phase deviation of PM.
13
Explanations
The unit of <phase deviation> is degree (°). Range: 0° to 180°
Example
:FUNCtion:PM:PHASe 100 set the phase deviation of PM as 100°
21. :FUNCtion:FSK:RATE
Syntax
:FUNCtion:FSK:RATE?
:FUNCtion:FSK:RATE {<rate>}
Function
Query/set the modulating rate of FSK.
Explanations
The unit of <rate> is Hz. Rate range: 2mHz~100kHz。
Example
:FUNCtion:FSK:RATE 100 set the modulating rate of FSK as 100Hz
22. :FUNCtion:FSK:HOPFreq
Syntax
:FUNCtion:FSK:HOPFreq?
:FUNCtion:FSK:HOPFreq {<frequency>}
Function
Query/set the hop frequency of FSK.
Explanations
The unit of <frequency> is Hz.
Example
:FUNCtion:FSK:HOPFreq 200 sets the hop frequency of FSK as 200Hz
23. :FUNCtion:PWM:DEViation
Syntax
:FUNCtion:FSK:DEViation?
:FUNCtion:FSK:DEViation {<width deviation>}
14
Function
Query/set the width deviation of PWM.
Explanations
The unit of <width deviation> is s.
Example
:FUNCtion:PWM:DEViation 2.00E-04 sets the width deviation of PWM as
200μs
24. :FUNCtion:SWEep:SWEeptime
Syntax
:FUNCtion:SWEep:SWEeptime?
:FUNCtion:SWEep:SWEeptime {<sweep time>}
Function
Query/set the sweep time needed for the generator to sweep from the start
frequency to the stop frequency.
Explanations
The unit of <sweep time> is s. Range: 1ms~500s。
Example
:FUNCtion:SWEep:SWEeptime 4 sets the sweep time as 4s.
25. :FUNCtion:SWEep:SPACing
Syntax
:FUNCtion:SWEep:SPACing?
:FUNCtion:SWEep:SPACing {LINear|LOGarithmic}
Function
Query/set linear or logarithmic spacing for the sweep, the default is LINear.
Explanations
Example
:FUNCtion:SWEep:SPACing LINear sets linear spacing for the sweep
15
26. :FUNCtion:SWEep:STARtfreq
Syntax
:FUNCtion:SWEep:STARtfreq?
:FUNCtion:SWEep:STARtfreq {<start frequency>}
Function
Query/set the start frequency for the sweep.
Explanations
The start frequency can be greater than the stop frequency; <start
frequency> is used with <stop frequency> together.
Example
:FUNCtion:SWEep:STARtfreq 100 sets the start frequency of sweep as
100Hz
27. :FUNCtion:SWEep:STOPfreq
Syntax
:FUNCtion:SWEep:STOPfreq?
:FUNCtion:SWEep:STOPfreq {<stop frequency>}
Function
Query/set the stop frequency for the sweep.
Explanations
Example
:FUNCtion:SWEep:STOPfreq 1000 sets the stop frequency of sweep as
1000Hz
28. :FUNCtion:SWEep:CENTrefreq
Syntax
:FUNCtion:SWEep:CENTrefreq?
:FUNCtion:SWEep:CENTrefreq {<center frequency>}
Function
Query/set the center frequency for the sweep.
16
Explanations
<center frequency> is used with <frequency span> together.
Example
:FUNCtion:SWEep:CENTrefreq 1000 sets the center frequency of sweep
as 1000Hz
29. :FUNCtion:SWEep:SPAN
Syntax
:FUNCtion:SWEep:SPAN?
:FUNCtion:SWEep:SPAN{<frequency span>}
Function
Query/set the frequency span for the sweep.
Explanations
Example
:FUNCtion:SWEep:SPAN 500 sets the frequency span of sweep as 500Hz
30. :FUNCtion:SWEep:SOURce
Syntax
:FUNCtion:SWEep:SOURce?
:FUNCtion:SWEep:SOURce {INTernal|EXTernal|MANual}
Function
Query/set the source for the sweep.
Explanations
INTernal: always sweep from the start frequency to the stop frequency.
EXTernal: sweep once when there is an external trigger (if the period of the
trigger signal is shorter than the sweep time, the sweep cannot be done
once).
MANual: choosing manual trigger; in Sweep interface, press the
knob on the front panel (or send a trigger command) to sweep
from the start frequency to the stop frequency once.
17
Example
:FUNCtion:SWEep:SOURce EXTernal sets the source of the sweep as
external.
31. :FUNCtion: SWEep:TRIGger
Syntax
:FUNCtion:SWEep: TRIGger 1
Function
The generator is triggered once for sweep
Explanations
This command is valid only when the source is set as manual. The
parameter 1 is meaningless; it can be any other value. This command
only trigger once every time.
Example
:FUNCtion:SWEep: TRIGger 1
32. :FUNCtion:BURSt:PERiod
Syntax
:FUNCtion:BURSt:PERiod?
:FUNCtion:BURSt:PERiod {<burst period>}
Function
Query/set the period of burst.
Explanations
When the source is not internal or the mode is gated, this command is
invalid. Range: 1ms~500s.
Example
:FUNCtion:BURSt:PERiod 2 sets the period of burst as 2s
33. :FUNCtion:BURSt:PHASe
Syntax
:FUNCtion:BURSt:PHASe?
18
:FUNCtion:BURSt:PHASe {<start phase>}
Function
Query/set the start phase of burst.
Explanations
Range: -360°~+360°
Example
:FUNCtion:BURSt:PHASe 120 sets the start phase of burst as 120°
34. :FUNCtion:BURSt:MODE
Syntax
:FUNCtion:BURSt:MODE?
:FUNCtion:BURSt:MODE { NCYCles|GATed}
Function
Query/set the burst mode (N-Cycle or Gated).
Explanations
Example
:FUNCtion:BURSt:MODE GATed sets the burst mode as N-Cycle.
35. :FUNCtion:BURSt:NCYCle
Syntax
:FUNCtion:BURSt:NCYCle?
:FUNCtion:BURSt:NCYCle {<cycle number>}
Function
Query/set the cycle number of burst.
Explanations
This command is invalid in gated mode or the cycle number is infinite.
Example
:FUNCtion:BURSt:NCYCle 110 sets the cycle number of burst as 110 cycle
19
36. :FUNCtion:BURSt:INFinite
Syntax
:FUNCtion:BURSt:INFinite?
:FUNCtion:BURSt:INFinite {CYCLes|INFinite }
Function
Query/set the cycle number of burst (finite or infinite).
Explanations
This command is invalid in gated mode.
Example
:FUNCtion:BURSt:INFinite INFinite sets the cycle number of burst as
infinite.
37. :FUNCtion:BURSt:POLarity
Syntax
:FUNCtion:BURSt:POLarity?
:FUNCtion:BURSt:POLarity { POSitive | NEGative }
Function
Query/set the polarity of burst in gated mode.
Explanations
This command is invalid in N-Cycle mode.
Example
:FUNCtion:BURSt:POLarity NEGative sets the polarity of burst in gated
mode as negative.
Target: Generate a sine wave with 20 kHz frequency, 2.5 Vpp amplitude, 500mV offset via
CH1.
Note: When setting frequency in step 3, the waveform has been select as sine. Step 3, 4,
5 do not require the fixed order; you can adjust based on your operating habits.
31
Step
SCPI Command
Comment
0
*IDN?
/*Query ID to check the operating state*/
1
:CHAN CH2
/*Set current channel as CH2*/
2
:FUNC:SINE:LOAD 100
/*Set the load as 100Ω*/
3
:FUNC:ARB:FREQ 2.0E+06
/*Set the frequency of the arbitrary wave*/
4
:FUNC:ARB:AMPL 5
/*Set the amplitude*/
5
:FUNC:ARB:OFFS 0.01
/*Set the offset*/
6
:FUNC:ARB:BUIL ExpRise
/*Select built-in wave function*/
7
:CHAN:CH2 ON
/*Enable the connector of CH2 at front panel*/
E.g. 2: To Generate a Built-in Arbitrary Wave via CH2
Target: Generate an ExpRise wave with 2MHz frequency, 5Vpp amplitude, 10mV offset
and 100Ω load via CH2.
32
Step
SCPI Command
Comment
0
*IDN?
/*Query ID to check the operating state*/
1
:CHAN CH1
/*Set current channel as CH1*/
2
:FUNC:SINE:LOAD OFF
/*Set the load as High Z*/
3
:FUNC:SINE:FREQ 10000
/*Set the frequency of carrier*/
4
:FUNC:SINE:AMPL 5
/*Set the amplitude of carrier*/
5
:FUNC:SINE:OFFS 0
/*Set the offset of carrier*/
6
:FUNC:FSK:source internal
/*Select internal modulation source*/
7
:FUNC:FSK:hopfreq 800
/* Set the hop frequency*/
8
:FUNC:FSK:RATE 200
/* Set the FSK rate*/
9
:CHAN:CH1 1
/*Enable the connector of CH1 at front panel*/
E.g. 3: To Generate a FSK Wave via CH1
Target: Generate a FSK wave with 10 kHz, 5 Vpp, 0 V offset carrier wave (Sine), internal
modulation source, 800 Hz hop frequency and 200 Hz FSK rate via CH1.
33
Step
SCPI Command
Comment
0
*IDN?
/*Query ID to check the operating state*/
1
:CHAN CH1
/*Set current channel as CH1*/
2
:FUNC:SINE:LOAD OFF
/*Set the load as High Z*/
3
:FUNC SQUARE
/*Square should be selected before enabling
frequency sweep*/
4
:FUNC SWEEP
/*Enable frequency sweep*/
5
:FUNC:SWEEP:SWEEPTIME 5
/*Set the sweep time*/
6
:FUNC:SWEEP:SPAC LIN
/*Select linear sweep mode*/
7
:FUNC:SWEEP:STAR 100
/*Set the start frequency*/
8
:FUNC:SWEEP:STOP 1000
/*Set the stop frequency*/
9
:FUNC:SWEEP:SOURCE INT
/*Select internal trigger source*/
10
:CHAN:CH1 ON
/*Enable the connector of CH1 at front panel*/
11
:CHAN CH2
/*Set current channel as CH2*/
12
:FUNC:RAMP:LOAD OFF
/*Set the load as High Z*/
13
:FUNC:RAMP:FREQ 1500
/*Set the frequency of the ramp wave*/
14
:FUNC:RAMP:AMPL 5
/*Set the amplitude*/
15
:FUNC:RAMP:OFFSET 1
/*Set the offset*/
16
:FUNC:RAMP:SYMM 33
/*Set the symmetry*/
E.g. 4: To Generate a Linear Sweep Wave via CH1 and
a Ramp Wave via CH2
Target: Generate a sweep square wave with 100Hz to 1kHz frequency, internal trigger,
linear mode and 5s sweep time via CH1. Generate a 1.5kHz, 5Vpp, 1V, 33% symmetry
ramp wave via CH2.
34
17
:CHAN:CH2 ON
/*Enable the connector of CH2 at front panel*/
Note:
If the parameters of the generator are not explicit, all the relevant parameters of the output
waveform should be set; if the parameters are explicit and meet the set requirements of
the output waveform, you do not need to set them.