RIGOL is a registered trademark of RIGOL TEC H NO LOGI ES, INC .
Publication Number
PGA21101-1110
Software Version
00.02.03
Software upgrade might change or add product features. Please acquire the latest version of the manual
from RIGOL website or contact RIGOL to upgrade the software.
Notices
RIGOL products are covered by P.R.C. and foreign patents, issued and pending.
RIGOL reserves the right to modify or change parts or all of the specifications and pricing policies at
the company's sole decision.
Information in this publication replaces all previously released ma terials.
Information in this publication is subject to change without notice.
RIGOL shall no t be liable for either incidental or consequential losses in connection with the furnishing,
use, or performance of this manual as well as any information contained.
Any par t of this document is forbidden to be copied, photocopied, or rearranged without prior written
approval of RIGOL.
Product Certification
RIGOL guarantees that this product conforms to the n ational and industrial standards in China as well as
the ISO9001:2008 standard and the ISO14001:2004 standard. Other international standard conformance
certifications are in progress.
Contact Us
If you have any problem or requirement when using our products or this manual, please contact RIGOL.
E-mail: service@rigol.com
Website: www.rigol.com
DS4000E Programming Guide I
RIGOL
Tip
RIGOL
Document Overview
This manual is your guide to programming RIGOL DS4000E series digital os cilloscope.
For the newest version of this manual, please download it from
official website (www.rigol.com).
Main Topics in this Manual:
Chapter 1 SCPI Command Overview
This chapter introduces the syntax, symbols, paramet ers, and abbreviation rules of the SCPI commands.
Chapter 2 Command System
This chapter introduce s the syntax, function, parameters, and usage of each command.
Chapter 3 Programming Examples
This chapter illustrates how t o control the DS400 0E series digital oscilloscope by programming i n Excel,
LabVIEW, MATLAB, Visual Basic 6.0, and Visual C++ 6.0.
Format Conventions in this Manual:
1. Function Key
The key on the front panel is denoted by the format of “Key Name (Bold) + Text Box” in the manual.
For example, Utility denotes the "Utility" key.
2.Menu Softkey
The menu softkey is denoted by the format of "Menu Name (Bold) + Character Shading" in the manual.
For example, System denotes the "System" softkey under Utility.
3. Operation Procedures
The next step is denoted by the arrow key (""). For example, UtilitySystem denotes that first
press Utility, and then press the System softkey.
Content Conventions in this Manual:
DS4000E series includes the following models. Unless otherwise specified, this manua l takes DS4024E as
an example to make a detailed introduction about the commands of DS4000E series.
Model
DS4024E
DS4014E
Bandwidth
200 MHz
100 MHz
No. of Channels
4
4
II DS4000E Programming Guide
Contents RIGOL
Contents
Guaranty and Declaration ......................................................................................................... I
Document Overview ................................................................................................................. II
LabVIEW Programming Example ................................................................................................ 3-7
MATLAB Programming Example ................................................................................................ 3-11
Visual Basic 6.0 Programming Example ..................................................................................... 3-13
Visual C++ 6.0 Programming Example ..................................................................................... 3-15
VIII DS4000E Programming Guide
Chapter 1 SCPI Command Overview RIGOL
Chapter 1 SCPI Command Overview
This chapter introduces the syntax, symbols, paramet ers, and abbreviation rules of the SCPI commands.
Contents in this chapter:
Syntax
Symbol Description
Parameter Type
Command Abbreviation
Syntax
The SCPI commands provide a hierarchical tree structure, and consist of multiple subsystems. Each
command subsystem consis ts of one root keyword and one or more sub-keywords. The command line
usually starts with a colon; the keywords are separated by colons, and following the keywords are the
parameter settings available. The command ending with a question mark indicates querying a certain
function. The keywords of the command and the first parameter is separated by a space.
For example,
:CALCulate:ADVanced:EXPRession <str>
:CALCulate:ADVanced:EXPRession?
CALCulate is the ro ot k ey word of th e c ommand. ADVanced is th e secon d-level keyword, and EXPRession is
the third-level keyword. The command line starts with a colon, a nd a colon is also used to separate the
multiple-level keywords. <str> represents the parameters available for setting. The command line ending
with a question mark indicates that it is a quer y command.
The command :CALCulate:ADVanced:EXPRession and the parameter <str> are separated by a space.
In some commands with multiple parameters, commas are often used to separate these parameters. For
example,
:SYSTem:DATE <yea r>,<month >, <da y >.
Symbol Description
1. Braces { }
The contents enclosed in the br aces are par ameter options, which are usually separated by the vertical
bar "|". When using the command, you must select one of the parameter options.
2. Vertical Bar |
The vertical bar is used to separate multiple parameter options. When using the command, you must
select one of the parameter options.
3.Square Brackets [ ]
The contents in the square brackets can be omitted.
4. Angle Brackets < >
The parameter enclosed in the angle brackets must be replaced by an effective value.
DS4000E Programming Guide 1-1
RIGOLChapter 1 SCPI Command Overview
Parameter Type
1. Bool
The available values for the parameter is 1 (ON) or 0 (OFF). For example,
:MEASure:ADISplay <bool >
:MEASure:ADISplay?
Wherein, <bool> can be set to {{1|ON}|{0|OFF}}.
The query returns 1 or 0.
2. Discrete
The parameter can be any of the values listed. For example,
:ACQuire:TYPE <type>
:ACQuire:TYPE?
Wherein, <type> can be set to NORMal, AVERages, PEAK, or HRESolution.
The query returns NORM, AVER, PEAK, or HRES.
3. Integer
Unless otherwise specified, the parameter can be any integer wit hi n the effective value r an ge. Do no t
set the parameter to a decimal or in scientific notation, otherwise, errors will occur. For example,
:DISPlay:GBRightne ss <br i ght>
:DISPlay:GBRightness?
Wherein, <brightness> can be set to an integer between 0 and 100.
The query returns an integer between 0 and 100.
4. Real
The parameter can be any real-value (in decimal form or in scientif ic notation) within the effective
value range. For example,
:FUNCtion:WREPlay:INTerval <interval>
:FUNCtion:WREPlay:INTerval?
Wherein, <interval> can be set to any real number between 0.0000 001 and 10; or any real numbe r
between (1.000000e-07, namely 100 ns) and (0.1e+02, namely 10 s).
The query returns a real number in scientific notation.
5. ASCII String
The parameter can be the combinations of ASCII characters. For example,
:CALCulate:ADVanced:EXPRession <str>
:CALCulate:ADVanced:EXPRession?
Wherein, <str> can be set to a legitimate expression that consists of any combinations of CH1, CH2,
CH3, CH4, and operators. For example, CH1+CH2.
The query returns in strings.
Command Abbreviation
All the commands are case-insensitive. The commands can be all input in uppercase letters or in lowercase
letters. For abbreviations, you must enter all the uppercase letters that exist in the command syntax.
For example, :MEASure:ADISplay?
can be abbreviated to :MEAS:ADIS?
1-2 DS4000E Programming Guide
Chapter 2 Command System RIGOL
Chapter 2 Command System
This chapter introduces the syntax, function, parameters, and usage of each DS4000E command.
1. Unless otherwise specified, the descriptions and parameter ra nge in this manual all take DS4024E as
an example.
2. For the parameter setting command (time, frequency, amplitude, etc.), the digital oscilloscope can
only recognize the numbers, unable to recognize the unit sent together with them. The unit of the
parameter is a default one. For the default units of various parameters, refer to the descriptions for the
specified command.
:AUToscale
Syntax
:AUToscale
Description
Enables the waveform auto setting function. The oscilloscope will automatically adjust the parameters such
as vertical scale, horizontal time base, and trigger mode according to the input signal to realize an optimum
waveform display. This command functions the same as the AUTO key on the front panel
Remarks
When the waveform auto setting function is disabled (refer to the :SYSTem:AUToscale command), this
DS4000E Programming Guide 2-1
.
command is invalid.
RIGOLChapter 2 Command System
When the pass/fail test function is enabled (refer to the :MASK:ENABle command), this command is
invalid.
The waveform auto setting function requires that the frequency of sine waveform is no less than 20 Hz
the duty cycle is greater than 1%, and the amplitude is at least 20 mVpp. Otherwise, the waveform
auto setting function may be invalid.
:CLEar
Syntax
:CLEar
Description
Clears all the waveforms on the screen. If the oscilloscope is in the RUN state, after the waveform data is
cleared, new waveform d ata will be displ ayed.
front panel.
This command functions the same as the CLEAR key on the
:RUN
:STOP
Syntax
:RUN
:STOP
Description
The :RUN command starts the oscilloscope and the :STOP command stops the oscilloscope. This command
functions the same as the Run/Stop key on the front panel.
Remarks
If the oscilloscope is in a single trigger mode (refer to the :SINGle command), you can use the :RUN
command to set the trigger mode of the oscilloscope to "Auto", and keep the oscilloscope in the "Run" state.
If the oscilloscope is in a single trigger mode (refer to the :SINGle command) and in WAIT state, you can
use the :STOP command to set the trigger mode of the oscilloscope to "Auto", and keep the oscilloscope in
the "Stop" state.
,
:SINGle
Syntax
:SINGle
Description
Sets the trigger mode of the oscilloscope to "Singl e". This command func tions the same as the Single key
on the front panel.
Remarks
In the single trigger mode, the oscilloscope performs a single tr ig g er when the trigger conditions are
If the oscilloscope is in a single trigger mode, you can use the :RUN command to set the trigger mode
If the oscilloscope is in a single trigger mode and in WAIT state, you can use the :STOP command to
2-2 DS4000E Programming Guide
met and then it stops. You can use the :TFORce command to generate a trigger by force.
of the oscillosc ope to "Auto", and keep the os cilloscope in the "Run" state.
set the trigger mode of the oscilloscope to "Auto", and keep the oscilloscope in the "Stop" state.
Chapter 2 Command System RIGOL
:TFORce
Syntax
:TFORce
Description
Generates a trigger signal forcefully. This com mand is only applicable to the normal and single trigger
modes, refer to the :TRIGger:SWEep
the trigger contro l area of the front p anel.
command. This command functions the same as the FORCE key in
:TLHAlf
Syntax
:TLHAlf
Description
Sets the trigger level to the vertical midpoint of the amplitude of a trigger signal. This command functions
the same as the 50% key in the trigger control area of the front panel.
omitted. You can refer to the complete introdu ctions of the c o m ma n ds in th e body of the t ext b a s ed o n t h e key w o r ds
listed here.
: In the "Command List" in this manual, the query commands and the parameters in the setting commands are
:ACQuire:AALias
Syntax
:ACQuire:AALias <bool>
:ACQuire:AALias?
Description
Enables or disables the anti-aliasing function of the oscilloscope; or queries the on/off status of the
anti-aliasing function.
Parameter
Name Type Range Default
[1]
:
<bool> Bool {{1|ON}|{0|OFF}} 0|OFF
Return Format
The query returns 1 or 0.
:ACQuire:AVERages
Syntax
:ACQuire:AVERages <count>
:ACQuire:AVERages?
Description
Sets or queries the number of averages in the average acquisition mode (refer to the :ACQuire:TYPE
command).
Parameter
Remarks
In the average acquisition mode, the oscilloscope will acquire the waveform samples for several times, then
make an average o n th e w av ef o rms, so as to lo wer th e ran dom no is es of th e inpu t sign als and incr ease its
vertical resolution. Greater number of averages can lower the noises and increase the vertical resolution,
but will also slow the response of the displayed waveform to the waveform changes.
Return Format
The query returns a n integer.
<count> Integer 2n (n indicates an integer between 1 and 13). 2
2-4 DS4000E Programming Guide
Chapter 2 Command System RIGOL
:ACQuire:MDEPth
Syntax
:ACQuire:MDEPth <mdep>
:ACQuire:MDEPth?
Description
Sets or queries the memory depth of the oscilloscope (namely the number of waveform points th at can be
stored through sampling in a single trigger). The default unit is pts (points).
Parameter
Remarks
The formula below describes the relationship among memory depth, sample rate, and waveform length:
Wherein, waveform length = horizontal time base x number of grids in the horiz ontal direction on t he
screen. For DS4000E, the number of grids in the horizontal direction on the screen is a fixed value 14. When
<mdep> is set to "AUTO", the oscilloscope will select the memory depth automatically according to the
current sample rate and horizontal time base (refer to the :TIMebase[:MAIN]:SCALe command).
Return Format
The query returns a n integer.
Name
<mdep> Discrete AUTO|7000|70000|700000|7000000 AUTO
TypeRangeDefault
memory depth = sample rate x waveform length
:ACQuire:SRATe?
Syntax
:ACQuire:SRATe?
Description
Queries the current sample rate of the oscilloscope. The default unit is Sa/s.
Return Format
The query returns the sample rate in s cientific notation.
:ACQuire:TYPE
Syntax
:ACQuire:TYPE <type>
:ACQuire:TYPE?
Description
Sets or queries the data acquisition mode of the oscilloscope.
Parameter
Remarks
NORMa l: In this mode, the oscilloscope samples the signal at the same interval to reconstruct the
AVERages: In this mode, the oscilloscope will acquire the waveform samples for several times, then
DS4000E Programming Guide 2-5
NameTypeRangeDefault
<type> Discrete {NORMal|AVERages|PEAK|HRESolution} NORMal
waveform. For most of the waveforms, this mode can realize the best display effects.
RIGOLChapter 2 Command System
make an average on the waveforms, so as to lower the random noises of the input signals and increase
its vertical resolution. You can use the :ACQuire:AVERages command to set the number of av erages in
this mode.
PEAK: The oscilloscope samples the maximum and minimum value of the signal at the fixed sampling
interval to acquire the signal envelope or the narrow pulses that might be lost. This mode can avoid the
signal aliasing, but produces greater noises.
HRE Solution: The oscilloscope will average the adjacent sample points of the sample waveform to
lower the random noises of the input signals and display much more smoother waveforms. If the
sample rate of the digital convertor is greater than the storage rate of the acquisition memory, this
mode is often adopted.
Returns the data in the decoding event table with the following formats.
#9000000077Parallel
Time,Data,
-9.3508796E-04,1,
6.5072008E-05,1,
1.0636000E-03,1,
Wherein, "#9000000077" is t he TMC data block header, which is followed by the data in the event table.
The 9-digit data following #9 in the data block header indicates the number of bytes of the effective data.
"Parallel" indicates the decoding type. The available decoding type can also be RS232, I2C, SPI, CAN, or
Flex. The data are separated by colons, and will automatically switch to the next line according to the line
length limit in the decoding list. The data value is related to the set numeral system.
Note: You can save all the data except TMC data block header (#9) and decoding type (Parallel)
"*.csv" file and view the data in the form of a list.
as the
DS4000E Programming Guide 2-7
RIGOLChapter 2 Command System
:BUS<n>:DISPlay
Syntax
:BUS<n>:DISPlay <bool>
:BUS<n>:DISPlay?
Description
Enables or disables the display of the specified decoding bus; or queries the on/off display status of the
specified decoding bus.
Description
Sets or queries the decoding type of the specified decoding bus.
Parameter
Remarks
RS232 decoding, IIC decoding, SPI decoding, CAN decoding, and FlexRay decoding are optional functions.
This command can be used only when you have installed these options.
Return Format
The query returns PAR, RS232, IIC, SPI, CAN, or FLEX.
Sets or queries the signal rate of CAN decoding on the specified bus. The default unit is b/s.
Parameter
Name
<n> Discrete {1|2} --
Type Range Default
Remarks
When <baud> is set to "U S E R ", you can use the :BUS<n>:CAN:BUSer command to self-define the signal
rate of CAN decoding on the specified bus.
Return Format
The query returns 100000, 125000, 250000, 400000, 500000, 800000, 1000000, or USER.
:BUS<n>:CAN:BUSer
Syntax
:BUS<n>:CA N:B USe r <ba u d>
:BUS<n>:CAN:BUSer?
Description
Sets or queries the user-defined signal rate of CAN decoding on the specified bus. The default unit is b/s.
Parameter
Return Format
The query returns an integer between 10000 and 1000000.
Name
<n> Discrete {1|2} -<baud> Integer 10000 to 1000000 500000
TypeRangeDefault
2-10 DS4000E Programming Guide
Chapter 2 Command System RIGOL
:BUS<n>:CAN:OFFSet
Syntax
:BUS<n>:CAN:OFFSet <val>
:BUS<n>:CAN:OFFSet?
Description
Sets or queries the vertical position of CAN decoding data line on the specified bus.
Parameter
Remarks
Before using the command, enable the display of the specified decoding bus (refer to
The range of <val> is related to the screen display mode and the on/off status of the statistic function
When the data line that displays the decoding is located in the middle part of the screen, <val > is 0;
Return Format
The query returns a n integer.
Name
<n> Discrete {1|2} -<val> Integer Refer to Remarks0
the :BUS<n>:DISPlay command).
(refer to the :MEASure:STATistic:DISPlay command).
When the display mode is "Full Screen" and the statistics function is disabled, the <val> parameter
ranges from -166 to +148.
When the display mode is "Full Screen" and the statistics function is enabled, the <val> parameter
ranges from -163 to +143.
When the display mode is "Split" (refer to the :TIMebase:DELay:ENABle and :CALCulate:FFT:SPLit
command), the <val> parameter ranges from -103 to +52.
when it is located above the middle part of the screen, <val> is a positive value; when it is located
below the middle part of the screen, <val> is a negative value.
Type Range Default
:BUS<n>:CAN:SOURce
Syntax
:BUS<n>:CAN:SO UR ce <s ourc e >
:BUS<n>:CAN:SOURce?
Description
Sets or queries the source channel of CAN decoding on the specified bus.
Sets or queries the sample point position of CAN decoding on the specified bus (expressed in %).
Parameter
Name
<n> Discrete {1|2} -<spo> Integer 5 to 95 50
Remarks
The sample point is within the range of the bit time. The oscilloscope samples the bit level at the sample
point. The sample point position is expressed as the ratio of "time from the bit start to the sample point" to
"bit time", in %.
Return Format
The query returns an integer between 5 and 95.
Type Range Default
:BUS<n>:CAN:STYPe
Syntax
:BUS<n>:CAN:S TYPe <stype>
:BUS<n>:CAN:STYPe?
Description
Sets or queries the signal type of CAN decoding on the specified bus.
Parameter
<n> Discrete {1|2} --
Remarks
RX: indicates the Receive signal from the CAN bus transceiver.
TX: indicates the Transmit signal from the CAN bus transceiver.
CANH: indicates the actual CAN_H differential bus signal.
CANL: indicates the actual CAN_L differential bus signal.
DIFFerential: indicates the CAN differential bus signal connected to an analog channel by using a
differential probe. The positive polarity of the differential probe connects the CAN_H bus signal, a nd
the negative polarity connects the CAN_L bus signal.
Sets or queries the signal rate of FlexRay decoding on the specified bus. The default unit is b/s.
Parameter
Return Format
The query returns 2500000, 5000000, or 10000000.
:BUS<n>:FLEXray:OFFSet
Syntax
:BUS<n>:FLEXra y :OF F Set <val>
:BUS<n>:FLEXray:OFFSet?
Description
Sets or queries the vertical position of FlexRay decoding on the specified bus.
Parameter
Remarks
Before using the command, enable the display of the specified decoding bus (refer to
The range of <val> is related to the screen display mode and the on/off status of the statistic function
When the data line that displays the decoding is located in the middle part of the screen, <val > is 0;
the :BUS<n>:DISPlay command).
(refer to the :MEASure:STATistic:DISPlay command).
When the display mode is "Full Screen" and the statistics function is disabled, the <val> parameter
ranges from -166 to +148.
When the display mode is "Full Screen" and the statistics function is enabled, the <val> parameter
ranges from -163 to +143.
When the display mode is "Split" (refer to the :TIMebase:DELay:ENABle and :CALCulate:FFT:SPLit
command), the <val> parameter ranges from -103 to +52.
when it is located above the middle part of the screen, <val> is a positive value; when it is located
0
2-14 DS4000E Programming Guide
Chapter 2 Command System RIGOL
Name
Type
Range
Default
below the middle part of the screen, <val> is a negative value.
Return Format
The query returns a n integer.
:BUS<n>:FLEXray:SOURce
Syntax
:BUS<n>:FLEXra y :SO UR ce <source>
:BUS<n>:FLEXray:SOURce?
Description
Sets or queries the source channel of FlexRay decoding on the specified bus.
Sets or queries the sample point position of FlexRa y decoding on the specified bus (expressed in %).
Parameter
Remarks
The sample point is within the range of the bit time. The oscilloscope samples the bit level at the sample
point. The sample point position is expressed as the ratio of "time from the bit start to the sample poi nt" to
"bit time", in %.
Sets or queries the vertical position of IIC decoding on the specified bus.
Parameter
Name Type Range Default
<n> Discrete {1|2} -<val> Integer Refer to Remarks0
Remarks
Before using the command, enable the display of the specified decoding bus (refer to
the :BUS<n>:DISPlay command).
The range of <val> is related to the screen display mode and the on/off status of the statistic function
(refer to the :MEASure:STATistic:DISPlay command).
When the display mode is "Full Screen" and the statistics function is disabled, the <val> parameter
ranges from -166 to +148.
When the display mode is "Full Screen" and the statistics function is enabled, the <val> parameter
ranges from -163 to +143.
When the display mode is "Split" (refer to the :TIMebase:DELay:ENABle and :CALCulate:FFT:SPLit
command), the <val> parameter ranges from -103 to +52.
When the data line that displays the decoding is located in the middle part of the screen, <val > is 0;
when it is located above the middle part of the screen, <val> is a positive value; when it is located
below the middle part of the screen, <val> is a negative value.
Sets or queries the threshold of the current clock line source channel of IIC decoding on the specified bus.
The default unit is V.
Parameter
Name Type Range Default
<n> Discrete {1|2}
--
Wherein, VerticalScale is the vertical scale of the clock line source
<thre> Real
Return Format
The query returns the threshold level in scientific notation.
channel, refer to the :CHANnel<n>:SCALe command; Offset is the
vertical position of the clock line source channel, refer to
the :CHANnel<n>:OFFSet command.
0
:BUS<n>:IIC:SDA:SOURce
Syntax
:BUS<n>:IIC:S DA :SO UR ce <s o urce>
:BUS<n>:IIC:SDA:SOURce?
Description
Sets or queries the source channel of the data line of IIC decoding on the specified bus.