This chapter introduces how to build communication between the instrument
and the PC. It also introduces how to configure a system for remote instrument
control. By using USB and LAN interfaces, in combination with NI-VISA and
programming languages, users can remotely control the instruments. Through
LAN interface, VXI-11, Sockets and Telnet protocols can be used to
communicate with the instruments.
1.1 Establishing Communications
1.1.1 Install NI-VISA
Before programming, you need to install the National Instruments NI-VISA
library, which you can download from the National Instruments web site.
Currently, NI-VISA is packaged in two versions: a full version and a Run-Time
Engine version. The full version includes the NI device drivers and a tool
named NI MAX which is a user interface to control and test remotely
connected devices. The Run-Time Engine is recommended, as it is a much
smaller download than the full version and includes the necessary tools for
basic communication to instruments.
For example, you can get the NI-VISA 5.4 full version from:
http://www.ni.com/download/ni-visa-5.4/4230/en/.
You also can download NI-VISA Run-Time Engine 5.4 to your PC and install it
as the default selection. Its installation process is similar with the full version.
After you downloaded the file, follow these steps to install NI-VISA (The full
version of NI-VISA 5.4 is used in this example. Newer versions are likely, and
should be compatible with SIGLENT instrumentation. Download the latest
version available for the operating system being used by the controlling
computer):
a. Double click the visa540_full.exe, dialog shown as below:
SDL1000X Programming Guide 1
SIGLENT
b. Click Unzip, the installation process will automatically launch after unzipping
files. If your computer needs to install .NET Framework 4, it may auto start.
c. The NI-VISA installing dialog is shown above. Click Next to start the
installation process.
d. Set the install path, default path is “C:\Program Files\National
Instruments\”, you can change it. Click Next, dialog shown as above.
SDL1000X Programming Guide 2
SIGLENT
e. Click Next twice, in the License Agreement dialog, select the “I accept the
above 2 License Agreement(s).”,and click Next, dialog shown as below:
f. Click Next to begin installation.
g. Now the installation is complete. Reboot your PC.
1.1.2 Connect the Instrument
Depending on the specific model, your electronic load may be able to
communicate with a PC through the USB or LAN interface.
Connect the instrument and the USB Host interface of the PC using a USB
SDL1000X Programming Guide 3
SIGLENT
cable. Assuming your PC is already turned on, turn on your electronic load,
and then the PC will display the “Device Setup”screen as it automatically
installs the device driver as shown below.
Wait for the installation to complete and then proceed to the next step.
1.2 Remote Control
1.2.1 User-defined Programming
Users can use SCPI commands via a computer to program and control the
electronic load. For details, refer to the introductions in "Programming
Examples".
1.2.2 Send SCPI Commands via NI_MAX
NI-Measurement and Automation eXplorer (NI-MAX) is a program created and
maintained by National Instruments. It provides a basic remote control
interface for VXI, LAN, USB, GPIB, and Serial communications. It is a utility
that enables you to send commands one-at-a-time and also retrieve data from
connected devices. It is a great tool for troubleshooting and testing command
sequences. The oscilloscopes can be controlled remotely by sending SCPI
commands via NI-MAX.
2. SCPI Overview
2.1Command Format
SCPI commands present a hierarchical tree structure containing multiple
subsystems, each of the subsystems is made up of a root keyword and several
subkeywords. The command string usually starts with “:”, the keywords are
separated by “:” and the followed parameter settings are separated by space.
Query commands add “?” at the end of the string.
For example:
:SENSe:FREQuency:CENTer <freq>
:SENSe:FREQuency:CENTer?
SENSe is the root key of the command, FREQuency and CENTer are second
and third keywords. The command begins with “:”, and separates the keywords
at the same time, <freq> separated by space and represents the parameter
available for setting; “?” represents a query.
SDL1000X Programming Guide 4
SIGLENT
2.2Symbol Instruction
The following four symbols are not the content of SCPI commands and can
not be sent with the commands, but are usually used in the commands.
1、Triangle Brackets < >
The parameter in the triangle brackets can be ignored.When parameter is
ignored, the instrument will set parameter to its default. For example: In
the“[:SOURce]:BATTery:LEVel <value>”command in“:SOURce:BATTery:
LEVel 4”.
2、Braces { }
The parameters in the braces are optional which can be ignored or set for one
or more times. For example:
The “{ON | OFF | 0 | 1}”parameter in “[:SOURce]:INPut[:STATe] {ON | OFF
| 0 | 1}”command.
3、Vertical Bar |
The vertical bar is used to separate multiple parameters and when sendi
ng the command,you can choose one of the parameters. For example, i
n the “[:SOURce]:INPut[:STATe] {ON | OFF | 0 | 1}” command, the par
ameters availiable are“OFF”、“ON”、“0”or“1”;such as “:SOURce:I
NPut:STATe ON” or “:SOURce:INPut:STATe 0”.
4、Square Brackets [ ]
The content in the square brackets can be ignored. When the parameter is
ignored, the instrument will set the parameter to its default. For exmple, In the
“[:SOURce]:INPut[:STATe]?” command, sending any of the four commands
below can generate the same effect:
:INPut?
:INPut:STATe?
:SOURce:INPut?
:SOURce:INPut:STATe?
2.3 Parameter Type
The parameters in the commands introduced in this manual include 5 types:
boolean, enumeration, integer, float, specific format.
SDL1000X Programming Guide 5
SIGLENT
1、Boolean
The parameters in the commands could be “OFF”, “ON”, “0” or “1”.
For example:
[:SOURce]:SHORt[:STATe] {ON | OFF | 0 | 1}
2、Enumeration
The parameter could be any of the values listed. For example:
[:SOURce]:FUNCtion {CURRent | VOLTage | POWer | RESistance | LED}
The parameter is “CURRent”、“VOLTage”、“POWer”、“RESistance”、“LED”
3、Integer
All parameters expressed by <number> and <step> are integer. It can be any
integer within the effective value range.
Notes: The command is invalid if the parameter value beyond the scope. The
parameter will be rounded to integer when it is decimal.
For example:
[:SOURce]:LIST:LEVel? <step>
The parameter <step> can be set to any integer in effective range. It wil
l be rounded to 3 when it is set to 3.988.
4、Float
All parameters expressed by <value> are float. It can be any float within the
effective value range.
Notes: The command is invalid if the parameter value beyond the scope. The
parameter is also regarded as float when it is integer.
For example:
[:SOURce]:CURRent:IRANGe < value >
The parameter < value > can be set to any real number between 0 and 30.
5、Specific format type
The parameter should be input in specific format and with specified symbol.
For example: LAN:IPADdress <aaa.bbb.ccc.ddd>
The parameter is separated by “.”. It is also take effect when lack numeric
characters. The parameter will be set in progressive type.
For example, if the oringnal IP address is “12.13.14.2”, IP address will be
set to “15.6.0.2” when the parameter is “15.6.0”.
2.4 Command Abbreviation
All of the commands are not case sensitive, so you can use any of them.
But if abbreviation is used, all the capital letters in the command must be
SDL1000X Programming Guide 6
SIGLENT
written completely. For example:
:SOURce:CURRent:SLEW:POSitive?
Can be abbreviated to:
:SOUR:CURR:SLEW:POS?
2.5Special instructions
1、When sets the current range,if <value> is greater than 5, the current range
will be set to 30A; if <value> is less than 5, the current range will be set to
5A.
2、 When sets the voltage range,if <value> is greater than 36, the voltage
range will be set to 150V; if <value> is less than 36, the voltage range will
be set to 36V.
3、 The parameters is {<value> | MINimum | MAXimum | DEFault}
enumerations. Its meanings are as follows
<value> :Any setting value
MINimum :The minimum value in the setting range
MAXimum :The maximum value in the setting range
DEFault :The default value for the setting value
SDL1000X Programming Guide 7
SIGLENT
Command
Format
*IDN?
Description
Returns an instrument identification information string. The string
will contain the manufacturer, model number, serial number and
software number.
Gets the discharging capacity after user start the BATTERY test.
Example
:SOURce:BATTery:DISCHArg:CAPability?
Response
13
Command
Format
[:SOURce]:BATTery:DISCHArg:TIMer?
Description
Gets the discharging time after user start the BATTERY test.
Example
:SOURce:BATTery:DISCHArg: TIMer?
Response
162
Command
Format
[:SOURce]:LIST:MODE {CURRent | VOLTage | POWer |
RESistance}
Description
Sets the run mode in LIST function.
Example
:SOURce:LIST:MODE VOLTage
Command
Format
[:SOURce]:LIST:MODE?
Description
Query the run mode in LIST function.
Example
:SOURce:LIST:MODE?
Response
CURRENT
Command
Format
[:SOURce]:LIST:IRANGe <value>
Description
Sets the current range in LIST function.
Example
:SOURce:LIST:IRANGe 5
Command
Format
[:SOURce]:LIST:IRANGe?
3.3.8 Source List Subsystem Command
SDL1000X Programming Guide 31
SIGLENT
Description
Query the current range in LIST function.
Example
:SOURce:LIST:IRANGe?
Response
30
Command
Format
[:SOURce]:LIST:VRANGe <value>
Description
Sets the voltage range in LIST function.
Example
:SOURce:LIST:VRANGe 150
Command
Format
[:SOURce]:LIST:VRANGe?
Description
Query the voltage range in LIST function.
Example
:SOURce:LIST:VRANGe?
Response
36
Command
Format
[:SOURce]:LIST:RRANGe {LOW | MIDDLE | HIGH |UPPER}
Description
Sets the resistor range in LIST function.
Example
SOURce:LIST:RRANGe HIGH
Command
Format
[:SOURce]:LIST:RRANGe?
Description
Query the resistor range in LIST function.
Example
:SOURce:LIST:RRANGe?
Response
UPPER
Command
Format
[:SOURce]:LIST:COUNt {< number > | MINimum | MAXimum |
DEFault}
Description
Sets the number of running loops in LIST function.
Example
:SOURce:LIST:COUNt 10
Command
Format
[:SOURce]:LIST:COUNt?
Description
Query the number of running loops in LIST function.
Example
:SOURce:LIST:COUNt?
Response
255
Command
Format
[:SOURce]:LIST:STEP {< number > | MINimum | MAXimum |
DEFault}
SDL1000X Programming Guide 32
SIGLENT
Description
Sets the execution of steps in LIST function.
Example
:SOURce:LIST: STEP 5
Command
Format
[:SOURce]:LIST:STEP?
Description
Query the execution of steps in LIST function.
Example
:SOURce:LIST:STEP?
Response
15
Command
Format
[:SOURce]:LIST:LEVel <step,value>
Description
Sets the set value of the step which is set in this command in LIST
sequence.
Example
:SOURce:LIST:LEVel 3,4.500
Command
Format
[:SOURce]:LIST:LEVel? <step>
Description
Query the set value of the step which is set in this command in
LIST sequence.
Example
[:SOURce]:LIST:LEVel? 5
Response
2.000
Command
Format
[:SOURce]:LIST:SLEW[:BOTH] <step,value>
Description
Sets the slope of the step which is set in this command in LIST CC
mode.
Example
:SOURce:LIST:SLEW:BOTH 4,0.500
Command
Format
[:SOURce]:LIST:SLEW[:BOTH]? <step>
Description
Query the slope of the step which is set in this command in LIST
CC mode.
Example
:SOURce:LIST:SLEW:BOTH? 5
Response
0.100
Command
Format
[:SOURce]:LIST:WIDth <step,value>
Description
Sets the run time of the step which is set in this command in LIST
sequence.
Example
:SOURce:LIST:WIDth 3,1.000
SDL1000X Programming Guide 33
SIGLENT
Command
Format
[:SOURce]:LIST:WIDth? <step>
Description
Query the run time of the step which is set in this command in
LIST sequence.
Example
:SOURce:LIST:WIDth? 5
Response
0.100
Command
Format
[:SOURce]:LIST:STATe:ON
Description
Enter the LIST function of the eclectronic load.
Example
:SOURce:LIST:STATe:ON
Command
Format
[:SOURce]:LIST:STATe?
Description
Query whether the electronic load is in LIST test mode.
Example
:SOURce:LIST:STATe?
Response
0.100
Command
Format
[:SOURce]: OCP:FUNC
Description
Enter the OCPT function of the eclectronic load.
Example
:SOURce: OCP:FUNC
Command
Format
[:SOURce]: OCP:FUNC?
Description
Query whether the electronic load is in OCPT test mode.
Example
:SOURce: OCP:FUNC?
Response
0
Command
Format
[:SOURce]:OCP:IRANGe <value>
Description
Sets the current range in OCPT function.
Example
:SOURce:OCP:IRANGe 30
Command
Format
[:SOURce]:OCP:IRANGe?
Description
Query the current range in OCPT function.
3.3.9 Source OCPT Subsystem Command
SDL1000X Programming Guide 34
SIGLENT
Example
:SOURce:OCP:IRANGe?
Response
5
Command
Format
[:SOURce]:OCP:VRANGe <value>
Description
Sets the voltage range in OCPT function.
Example
:SOURce:OCP:VRANGe 36
Command
Format
[:SOURce]:OCP:VRANGe?
Description
Query the voltage range in OCPT function.
Example
:SOURce:OCP:VRANGe?
Response
150
Command
Format
[:SOURce]:OCP:STARt {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the current value when the load starts in OCPT test.
Example
:SOURce:OCP:STARt 1.000
Command
Format
[:SOURce]:OCP:STARt?
Description
Query the current value when the load starts in OCPT test.
Example
:SOURce:OCP:STARt?
Response
1.000
Command
Format
[:SOURce]:OCP:STEP {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the step current value in OCPT function.
Example
:SOURce:OCP: STEP 0.500
Command
Format
[:SOURce]:OCP:STEP?
Description
Query the step current value in OCPT function.
Example
:SOURce:OCP: STEP?
Response
1.000
Command
Format
[:SOURce]:OCP:STEP:DELay {< value > | MINimum |
MAXimum | DEFault}
Description
Sets the delay time of each step in OCPT function.
Example
:SOURce:OCP:STEP:DELay 1.000
SDL1000X Programming Guide 35
SIGLENT
Command
Format
[:SOURce]:OCP:STEP:DELay?
Description
Query the delay time of each step in OCPT function.
Example
:SOURce:OCP:STEP:DELay?
Response
2.000
Command
Format
[:SOURce]:OCP:END {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the stop current in OCPT function.
Example
:SOURce:OCP: END 5.000
Command
Format
[:SOURce]:OCP:END?
Description
Query the stop current in OCPT function.
Example
:SOURce:OCP: END?
Response
4.000
Command
Format
[:SOURce]:OCP:MIN {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the minimum value of the protection current in OCPT
function.
Example
:SOURce:OCP: MIN 2.000
Command
Format
[:SOURce]:OCP:MIN?
Description
Query the minimum value of the protection current in OCPT
function.
Example
:SOURce:OCP: MIN?
Response
3.000
Command
Format
[:SOURce]:OCP:MAX {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the maximum value of the protection current in OCPT
function.
Example
:SOURce:OCP: MAX 10.000
Command
Format
[:SOURce]:OCP:MAX?
Description
Query the maximum value of the protection current in OCPT
SDL1000X Programming Guide 36
SIGLENT
function.
Example
:SOURce:OCP: MAX?
Response
8.000
Command
Format
[:SOURce]:OCP:VOLTage {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the protection voltage in OCPT function.
Example
:SOURce:OCP: VOLTage 8.000
Command
Format
[:SOURce]:OCP:VOLTage?
Description
Query the value of the protection voltage in OCPT function.
Example
:SOURce:OCP: VOLTage?
Response
10.000
Command
Format
[:SOURce]: OPP:FUNC
Description
Enter the OPPT function of the eclectronic load.
Example
:SOURce: OPP:FUNC
Command
Format
[:SOURce]: OPP:FUNC?
Description
Query whether the electronic load is in OPPT test mode.
Example
:SOURce: OPP:FUNC?
Response
1
Command
Format
[:SOURce]:OPP:IRANGe <value>
Description
Sets the current range in OPPT function.
Example
:SOURce:OPP:IRANGe 30
Command
Format
[:SOURce]:OPP:IRANGe?
Description
Query the current range in OPPT function.
Example
:SOURce:OPP:IRANGe?
Response
5
3.3.10 Source OPPT Subsystem Command
SDL1000X Programming Guide 37
SIGLENT
Command
Format
[:SOURce]:OPP:VRANGe <value>
Description
Sets the voltage range in OPPT function.
Example
:SOURce:OPP:VRANGe 36
Command
Format
[:SOURce]:OPP:VRANGe?
Description
Query the voltage range in OPPT function.
Example
:SOURce:OPP:VRANGe?
Response
150
Command
Format
[:SOURce]:OPP:STARt {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the power value when the load starts in OPPT test.
Example
:SOURce:OPP:STARt 1.000
Command
Format
[:SOURce]:OPP:STARt?
Description
Query the power value when the load starts in OPPT test.
Example
:SOURce:OPP:STARt?
Response
1.000
Command
Format
[:SOURce]:OPP:STEP {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the step power value in OPPT function.
Example
:SOURce:OPP: STEP 0.500
Command
Format
[:SOURce]:OPP:STEP?
Description
Query the step power value in OPPT function.
Example
:SOURce:OPP: STEP?
Response
1.000
Command
Format
[:SOURce]:OPP:STEP:DELay {< value > | MINimum |
MAXimum | DEFault}
Description
Sets the delay time of each step in OPPT function.
Example
:SOURce:OPP:STEP:DELay 1.000
SDL1000X Programming Guide 38
SIGLENT
Command
Format
[:SOURce]:OPP:STEP:DELay?
Description
Query the delay time of each step in OPPT function.
Example
:SOURce:OPP:STEP:DELay?
Response
2.000
Command
Format
[:SOURce]:OPP:END {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the stop power value in OCPT function.
Example
:SOURce:OPP: END 5.000
Command
Format
[:SOURce]:OPP:END?
Description
Query the stop power value in OPPT function.
Example
:SOURce:OPP: END?
Response
4.000
Command
Format
[:SOURce]:OPP:MIN {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the minimum value of the protection power in OPPT function.
Example
:SOURce:OPP: MIN 2.000
Command
Format
[:SOURce]:OPP:MIN?
Description
Query the minimum value of the protection power in OPPT
function.
Example
:SOURce:OPP: MIN?
Response
3.000
Command
Format
[:SOURce]:OPP:MAX {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the maximum value of the protection power in OPPT function.
Example
:SOURce:OPP: MAX 10.000
Command
Format
[:SOURce]:OPP:MAX?
Description
Query the maximum value of the protection power in OPPT
function.
Example
:SOURce:OPP: MAX?
Response
8.000
SDL1000X Programming Guide 39
SIGLENT
Command
Format
[:SOURce]:OPP:VOLTage {< value > | MINimum | MAXimum |
DEFault}
Description
Sets the protection voltage in OPPT function.
Example
:SOURce:OPP: VOLTage 8.000
Command
Format
[:SOURce]:OPP:VOLTage?
Description
Query the value of the protection voltage in OPPT function.
Example
:SOURce:OPP: VOLTage?
Response
10.000
Command
Format
[:SOURce]:PROGram:STEP {< number > | MINimum |
MAXimum | DEFault}
Description
Sets the execution of steps in PROGRAM function.
Example
:SOURce:PROGram:STEP 8
Command
Format
[:SOURce]:PROGram:STEP?
Description
Query the execution of steps in PROGRAM function.
Example
:SOURce:PROGram:STEP?
Response
10
Command
Format
[:SOURce]:PROGram:MODE <step, {CURRent | VOLTage |
POWer | RESistance | LED}>
Description
Sets the mode of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:MODE 2,VOLTage
Command
Format
[:SOURce]:PROGram:MODE? <step>
Description
Query the mode of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:MODE? 3
Response
2.000
Command
[:SOURce]:PROGram:IRANGe <step, value>
3.3.11 Source Program Subsystem Command
SDL1000X Programming Guide 40
SIGLENT
Format
Description
Sets the current range of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:IRANGe 4,5
Command
Format
[:SOURce]:PROGram:IRANGe? <step>
Description
Query the current range of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:IRANGe? 5
Response
30
Command
Format
[:SOURce]:PROGram:VRANGe <step, value>
Description
Sets the voltage range of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:VRANGe 3,36
Command
Format
[:SOURce]:PROGram:VRANGe? <step>
Description
Query the voltage range of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:VRANGe? 2
Response
150
Command
Format
[:SOURce]:PROGram:RRANGe <step, {LOW | MIDDLE | HIGH
| UPPER}>
Description
Sets the resistor range of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram: RRANGe 3,LOW
Command
Format
[:SOURce]:PROGram:RRANGe? <step>
Description
Query the resistor range of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram: RRANGe? 3
Response
MIDDLE
Command
Format
[:SOURce]:PROGram:SHORt <step, {ON | OFF | 0 | 1 }>
SDL1000X Programming Guide 41
SIGLENT
Description
Whether set the step of the electronic load which is set in this
command to be short circuit in PROGRAM test list.
Example
:SOURce:PROGram: SHORt 3,ON
Command
Format
[:SOURce]:PROGram:SHORt? <step>
Description
Query Whether the step of the electronic load which is set in this
command is short circuit in PROGRAM test list.
Example
:SOURce:PROGram: SHORt? 4
Response
0
Command
Format
[:SOURce]:PROGram:PAUSE <step, {ON | OFF | 0 | 1 }>
Description
Whether pause the step of the electronic load which is set in this
command in PROGRAM test list.
Example
:SOURce:PROGram: PAUSE 2,1
Command
Format
[:SOURce]:PROGram:PAUSE? <step>
Description
Query Whether the step of the electronic load which is set in this
command is paused in PROGRAM test list.
Example
:SOURce:PROGram: PAUSE? 5
Response
0
Command
Format
[:SOURce]:PROGram:TIME:ON <step, {< value > | MINimum |
MAXimum | DEFault}>
Description
Sets the loading time of the step which is set in this command in
PROGRAM test list. Its unit is “s”
Example
:SOURce:PROGram:TIME:ON 4,1.000
Command
Format
[:SOURce]:PROGram:TIME:ON? <step>
Description
Query the loading time of the step which is set in this command in
PROGRAM test list. Its unit is “s”
Example
:SOURce:PROGram:TIME:ON? 5
Response
0.500
Command
Format
[:SOURce]:PROGram:TIME:OFF <step, {< value > | MINimum |
MAXimum | DEFault}>
Description
Sets the unloading time of the step which is set in this command in
SDL1000X Programming Guide 42
SIGLENT
PROGRAM test list. Its unit is “s”
Example
:SOURce:PROGram:TIME:OFF 4,0.500
Command
Format
[:SOURce]:PROGram:TIME:OFF? <step>
Description
Query the unloading time of the step which is set in this command
in PROGRAM test list. Its unit is “s”
Example
:SOURce:PROGram:TIME:OFF? 6
Response
2.000
Command
Format
[:SOURce]:PROGram:TIME:DELay <step, {< value > | MINimum
| MAXimum | DEFault}>
Description
Sets test delay time of the step which is set in this command in
PROGRAM test list. Its unit is “s”
Example
:SOURce:PROGram:TIME: DELay 3,0.500
Command
Format
[:SOURce]:PROGram:TIME:DELay? <step>
Description
Query test delay time of the step which is set in this command in
PROGRAM test list. Its unit is “s”
Example
:SOURce:PROGram:TIME: DELay? 1
Response
0.600
Command
Format
[:SOURce]:PROGram:MIN <step, {< value > | MINimum |
MAXimum | DEFault}>
Description
Sets the minimum allowed value of the step which is set in this
command in PROGRAM test list. The value is current value in CV
and is voltage value in CC/CR/CP/LED.
Example
:SOURce:PROGram:MIN 3,1.000
Command
Format
[:SOURce]:PROGram:MIN? <step>
Description
Query the minimum allowed value of the step which is set in this
command in PROGRAM test list. The value is current value in CV
and is voltage value in CC/CR/CP/LED.
Example
:SOURce:PROGram:MIN? 5
Response
2.000
Command
Format
[:SOURce]:PROGram:MAX <step, {< value > | MINimum |
MAXimum | DEFault}>
SDL1000X Programming Guide 43
SIGLENT
Description
Sets the maximum allowed value of the step which is set in this
command in PROGRAM test list. The value is current value in CV
and is voltage value in CC/CR/CP/LED.
Example
:SOURce:PROGram: MAX 2,10.000
Command
Format
[:SOURce]:PROGram:MAX? <step>
Description
Query the minimum allowed value of the step which is set in this
command in PROGRAM test list. The value is current value in CV
and is voltage value in CC/CR/CP/LED.
Example
:SOURce:PROGram:MAX? 3
Response
15.000
Command
Format
[:SOURce]:PROGram:LEVel <step, {< value > | MINimum |
MAXimum | DEFault}>
Description
Sets the sink value of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:LEVel 6,7.000
Command
Format
[:SOURce]:PROGram:LEVel? <step>
Description
Query the set value of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:LEVel? 2
Response
6.000
Command
Format
[:SOURce]:PROGram:LED:CURRent <step, {< value > |
MINimum | MAXimum | DEFault}>
Description
Sets the “Io” value of the step which is set in this command in
PROGRAM function when the step is in LED mode.
Example
:SOURce:PROGram: LED:CURRent 6,7.000
Command
Format
[:SOURce]:PROGram:LED:CURRent? <step>
Description
Query the “Io” value of the step which is set in this command in
PROGRAM function when the step is in LED mode.
Example
:SOURce:PROGram: LED:CURRent? 4
Response
1.000
SDL1000X Programming Guide 44
SIGLENT
Command
Format
[:SOURce]:PROGram:LED:RCOnf <step, {< value > | MINimum |
MAXimum | DEFault}>
Description
Sets the “Rco” value of the step which is set in this command in
PROGRAM function when the step is in LED mode.
Example
:SOURce:PROGram: LED: RCOnf 6,0.300
Command
Format
[:SOURce]:PROGram:LED:RCOnf? <step>
Description
Query the “Rco” value of the step which is set in this command in
PROGRAM function when the step is in LED mode.
Example
:SOURce:PROGram: LED: RCOnf? 5
Response
0.200
Command
Format
[:SOURce]:PROGram:STATe:ON
Description
Enter the PROGRAM test mode of the eclectronic load .
Example
:SOURce:PROGram:STATe:ON
Command
Format
[:SOURce]:PROGram:STATe?
Description
Query whether the load is in PROGRAM test mode.
Example
:SOURce:PROGram:STATe?
Response
0
Command
Format
[:SOURce]:PROGram:TEST? <step>
Description
Query the test rusult of the step which is set in this command in
PROGRAM test list.
Example
:SOURce:PROGram:TEST? 3
Response
3.584720
Command
Format
[:SOURce]:WAVE:TIME < number >
Description
Sets the window time in Waveform Display Function. Its unit is “s”
Example
:SOURce:WAVE:TIME 8
3.3.12 Source Wave Subsystem Command
SDL1000X Programming Guide 45
SIGLENT
Command
Format
[:SOURce]:WAVE:TIME?
Description
Query the window time in Waveform Display Function. Its unit is
“s”
Example
:SOURce:WAVE:TIME?
Response
3600
Command
Format
[:SOURce]:WAVE:MODE {CURRent | VOLTage | POWer |
RESistance }
Description
Sets different data type include I, U, R and P displayed in
Waveform Display Function.
Example
:SOURce]:WAVE:MODE CURRent
Command
Format
[:SOURce]:WAVE:MODE?
Description
Query the displayed data type in Waveform Display Function.
Example
:SOURce]:WAVE:MODE?
Response
VOLTAGE
Command
Format
[:SOURce]:WAVE:PAUSE {ON | OFF | 0 | 1}
Description
Sets whether pause the waveform displayed in the Waveform
Display Function.
Example
:SOURce:WAVE:PAUSE ON
Command
Format
[:SOURce]:WAVE:PAUSE?
Description
Query whether the waveform displayed in the Waveform Display
Function is paused.
Example
:SOURce:WAVE:PAUSE?
Response
1
Command
Format
[:SOURce]:WAVE:DISPlay {ON|OFF|0|1}
Description
Enter the Waveform Display Function of the electronic load.
Example
:SOURce:WAVE:DISPlay ON
SDL1000X Programming Guide 46
Command
Format
[:SOURce]:WAVE:DISPlay?
Description
Query whether the electronic load is in Waveform Display
Function.
Example
:SOURce:WAVE:DISPlay?
Response
ON
Command
Format
[:SOURce]:VOLTage[:LEVel]:ON <value>
Description
Sets the breakover voltage of electronic load.
Example
:SOURce:VOLTage:LEVel:ON 6.000
Command
Format
[:SOURce]:VOLTage[:LEVel]:ON?
Description
Query the value of the breakover voltage of electronic load.
Example
:SOURce:VOLTage:LEVel:ON?
Response
4.000
Command
Format
[:SOURce]:VOLTage:LATCh[:STATe] {ON | OFF | 0 | 1}
Description
Sets whether enable the Von Latch switch of the electronic load.
Example
:SOURce:VOLTage:LATCh:STATe OFF
Command
Format
[:SOURce]:VOLTage:LATCh[:STATe]?
Description
Query whether the Von Latch switch of the electronic load is
enabled.
Example
:SOURce:VOLTage:LATCh:STATe?
Response
0
Command
Format
[:SOURce]:EXT:INPUT[:StATe] {ON | OFF | 0 | 1}
Description
Sets whether enable the external control switch on the rear panel of
the electronic load.
Example
:SOURce: EXT:INPUT:STATe OFF
3.3.13 Source Utility Subsystem Command
SIGLENT
SDL1000X Programming Guide 47
SIGLENT
Command
Format
[:SOURce]: EXT:INPUT [:STATe]?
Description
Query whether the external control switch of the electronic load is
enabled.
Example
:SOURce: EXT:INPUT:STATe?
Response
0
Command
Format
[:SOURce]:CURRent:PROTection:STATe {ON | OFF | 0 | 1}
Description
Sets whether enable the current protection switch of the electronic
load.
Example
:SOURce:CURRent:PROTection:STATe ON
Command
Format
[:SOURce]: EXT:INPUT [:STATe]?
Description
Query whether the current protection switch of the electronic load
is enabled.
Example
:SOURce: EXT:INPUT:STATe?
Response
0
Command
Format
[:SOURce]:CURRent:PROTection:LEVel {< value > | MINimum |
MAXimum | DEFault}
Description
Sets the threhold value of the current protection of the electronic
load after enable the current protection function.
Example
:SOURce:CURRent:PROTection:LEVel 7.00
Command
Format
[:SOURce]:CURRent:PROTection:LEVel?
Description
Query the threhold value of the current protection of the electronic
load.
Example
:SOURce:CURRent:PROTection:LEVel?
Response
8.000
Command
Format
[:SOURce]:CURRent:PROTection:DELay {< value > | MINimum |
MAXimum | DEFault}
Description
Sets the delay time of the current protection of the electronic load .
Example
:SOURce:CURRent:PROTection:DELay 2.00
SDL1000X Programming Guide 48
SIGLENT
Command
Format
[:SOURce]:CURRent:PROTection:DELay?
Description
Query the delay time of the current protection of the electronic
load.
Example
:SOURce:CURRent:PROTection:DELay?
Response
3.000
Command
Format
[:SOURce]:POWer:PROTection:STATe {ON | OFF | 0 | 1}
Description
Sets whether enable the power protection switch of the electronic
load.
Example
:SOURce:POWer:PROTection:STATe ON
Command
Format
[:SOURce]:POWer:PROTection:STATe?
Description
Query whether the power protection switch of the electronic load is
enabled.
Example
:SOURce:POWer:PROTection:STATe?
Response
1
Command
Format
[:SOURce]:POWer:PROTection:LEVel {< value > | MINimum |
MAXimum | DEFault}
Description
Sets the threhold value of the power protection of the electronic
load after enable the power protection function.
Example
:SOURce:POWer:PROTection:LEVel 7.00
Command
Format
[:SOURce]:POWer:PROTection:LEVel?
Description
Query the threhold value of the power protection of the electronic
load.
Example
:SOURce:POWer:PROTection:LEVel?
Response
8.000
Command
Format
[:SOURce]:POWer:PROTection:DELay {< value > | MINimum |
MAXimum | DEFault}
Description
Sets the delay time of the power protection of the electronic load
after enable the power protection function.
Example
:SOURce:POWer:PROTection:DELay 2.00
SDL1000X Programming Guide 49
SIGLENT
Command
Format
[:SOURce]:POWer:PROTection:DELay?
Description
Query the delay time of the power protection of the electronic load.
Example
:SOURce:POWer:PROTection:DELay?
Response
3.000
Command
Format
SYSTem:SENSe[:STATe] {ON | OFF | 0 | 1}
Description
Sets whether enable the Sense function switch of the electronic
load.
Example
SYSTem:SENSe:STATe OFF
Command
Format
SYSTem:SENSe[:STATe]?
Description
Query whether the Sense function switch of the electronic load is
enabled.
Example
SYSTem:SENSe:STATe?
Response
1
Command
Format
SYSTem:IMONItor[:STATe] {ON | OFF | 0 | 1}
Description
Sets whether enable the current monitoring terminal switch of the
electronic load.
Example
SYSTem:IMONItor:STATe OFF
Command
Format
SYSTem: IMONItor [:STATe]?
Description
Query whether the current monitoring terminal switch of the
electronic load is enabled.
Example
SYSTem: IMONItor:STATe?
Response
1
Command
Format
SYSTem:VMONItor[:STATe] {ON | OFF | 0 | 1}
3.4 Subsystem Command
SDL1000X Programming Guide 50
SIGLENT
Description
Sets whether enable the voltage monitoring terminal switch of the
electronic load.
Example
SYSTem:VMONItor:STATe OFF
Command
Format
SYSTem: VMONItor [:STATe]?
Description
Query whether the voltage monitoring terminal switch of the
electronic load is enabled.
Example
SYSTem: VMONItor:STATe?
Response
1
Command
Format
STOP:ON:FAIL[:STATe] {ON | OFF | 0 | 1}
Description
Sets whether stop the PROGRAM test when test step is failed.
Sets the average point number of the read-back current and voltage
of the electronic load. The value is the index of “2”.
Example
SENSe:AVERage:COUNt 10
Command
Format
SENSe:AVERage:COUNt?
Description
Query the average point number of the read-back current and
voltage of the electronic load. The value is the index of “2”
Example
SENSe:AVERage:COUNt?
Response
9
Command
Format
EXT:MODE {INT | EXTI | EXTV}
Description
Sets the sink mode include external or internal mode of the
electronic load.
Example
EXT:MODE INT
Command
Format
EXT:MODE?
Description
Query the sink mode include external or internal mode of the
electronic load.
Example
EXT:MODE?
Response
EXTV
Command
Format
EXT:IRANGe <value>
Description
Sets the current range in external sink mode of the electronic load.
Example
EXT:IRANGe 5
Command
Format
EXT:IRANGe?
Description
Query the current range in external sink mode of the electronic
load.
Example
EXT:IRANGe?
Response
30
SDL1000X Programming Guide 52
SIGLENT
Command
Format
EXT:VRANGe <value>
Description
Sets the voltage range in external sink mode of the electronic load.
Example
EXT:VRANGe 36
Command
Format
EXT:VRANGe?
Description
Query the voltage range in external sink mode of the electronic
load.
Example
EXT:VRANGe?
Response
150
Command
Format
TIME:TEST[:STATe] {ON | OFF | 0 | 1}
Description
Sets whether enable the time measurement switch.
Example
TIME:TEST:STATe OFF
Command
Format
TIME:TEST[:STATe]?
Description
Query whether the time measurement switch is enabled.
Example
TIME:TEST:STATe?
Response
0
Command
Format
TIME:TEST:VOLTage:LOW {< value > | MINimum | MAXimum
| DEFault}
Description
Sets the V_Low voltage in the time measurement function
(SLMT).
Example
TIME:TEST:VOLTage:LOW 1.000
Command
Format
TIME:TEST:VOLTage:LOW?
Description
Query the V_Low voltage in the time measurement function
(SLMT).
Example
TIME:TEST:VOLTage:LOW?
Response
3.00
SDL1000X Programming Guide 53
SIGLENT
Command
Format
TIME:TEST:VOLTage:HIGH {< value > | MINimum | MAXimum
| DEFault}
Description
Sets the V_High voltage in the time measurement function
(SLMT).
Example
TIME:TEST:VOLTage: HIGH 10.000
Command
Format
TIME:TEST:VOLTage:HIGH?
Description
Query the V_High voltage in the time measurement function
(SLMT).
Example
TIME:TEST:VOLTage: HIGH?
Response
150.00
Command
Format
TIME:TEST:RISE?
Description
Query the voltage rise time in the time measurement function
(SLMT).
Example
TIME:TEST:RISE?
Response
0.020
Command
Format
TIME:TEST:FALL?
Description
Query the voltage descending time in the time measurement
function (SLMT).
Example
TIME:TEST: FALL?
Response
0.030
Command
Format
LAN:LINK?
Description
Query whether the LAN interface of the electronic load had been
connect to the network.
Example
LAN:LINK?
Response
0
3.5 LAN Interface Subsystem Command
SDL1000X Programming Guide 54
SIGLENT
Command
Format
DHCP {ON | OFF | 0 | 1}
Description
Sets whether enable the DHCP switch of the electronic load.
Example
DHCP ON
Command
Format
DHCP?
Description
Query whether the DHCP switch of the electronic load is enabled
Example
DHCP?
Response
1
Command
Format
LAN:IPADdress <aaa.bbb.ccc.ddd>
Description
Sets IP address of the electronic load when DHCP is disabled.
Example
LAN:IPADdress 10.12.15.64
Command
Format
LAN:IPADdress?
Description
Query the IP address of the electronic load.
Example
LAN:IPADdress?
Response
10.11.13.76
Command
Format
LAN:SMASk <aaa.bbb.ccc.ddd>
Description
Sets the subnet mask of the electronic load when DHCP is
disabled.
Example
LAN: SMASk 255.255.255.255
Command
Format
LAN:SMASk?
Description
Sets the subnet mask of the electronic load.
Example
LAN: SMASk?
Response
255.255.255.0
Command
Format
LAN:GATeway <aaa.bbb.ccc.ddd>
SDL1000X Programming Guide 55
SIGLENT
Description
Sets the gateway of the electronic load when DHCP is disabled.
Example
LAN: GATeway 10.11.13.1
Command
Format
LAN:GATeway?
Description
Query the subnet mask of the electronic load.
Example
LAN: GATeway?
Response
10.12.16.1
Command
Format
LAN:MAC?
Description
Query the MAC address of the electronic load.
Example
LAN:MAC?
Response
00.80.e1.00.00.00
SDL1000X Programming Guide 56
SIGLENT
4. Programming Examples
This chapter gives some examples for the programmer. In these examples
you can see how to use the VISA or sockets, in combination with the
commands have been described above to control the spectrum analyzer. By
following these examples, you can develop many more applications.
4.1 Examples of Using VISA
4.1.1 Example of VC++
Environment: Win7 32bit system, Visual Studio
The functions of this example: use the NI-VISA, to control the device with
USBTMC or TCP/IP access to do a write and read.
Follow the steps to finish the example:
1、 Open Visual Studio, create a new VC++ win32 console project.
2、 Set the project environment to use the NI-VISA lib, there are two ways to
use NI-VISA, static or automatic:
(1) Static: find files: visa.h, visatype.h, visa32.lib in NI-VISA install path. Copy
them to your project, and add them into project. In the projectname.cpp file,
add the follow two lines:
#include "visa.h"
#pragma comment (lib,"visa32.lib")
(2) Automatic:
Set the .h file include directory, the NI-VISA install path, in our computer we set
the path is: C:\Program Files\IVI Foundation \VISA\WinNT\include. Set this
path to project---properties---c/c++---General---Additional Include Directories:
See the picture.
SDL1000X Programming Guide 57
SIGLENT
Set lib path set lib file:
Set lib path: the NI-VISA install path, in our computer we set the path is:
C:\Program Files\IVI Foundation\VISA\WinNT \lib\msc. Set this path to
project---properties---Linker---General---Additional Library Directories: as seen
in the pictures below.
Set lib file:project---properties---Linker---Command Line---Additional Options:
visa32.lib
SDL1000X Programming Guide 58
Include visa.h file: In the projectname.cpp file:
SIGLENT
#include <visa.h>
3、Add codes:
(1)USBTMC access code.
Write a function Usbtmc_test:
int Usbtmc_test()
{
/* This code demonstrates sending synchronous read & write commands */
/* to an USB Test & Measurement Class (USBTMC) instrument using */
/* NI-VISA */
/* The example writes the "*IDN?\n" string to all the USBTMC */
/* devices connected to the system and attempts to read back */
/* results using the write and read functions. */
/* The general flow of the code is */
/* Open Resource Manager */
/* Open VISA Session to an Instrument */
/* Write the Identification Query Using viPrintf */
/* Try to Read a Response With viScanf */
/* Close the VISA Session */
SDL1000X Programming Guide 59
SIGLENT
/***********************************************************/
ViSessiondefaultRM;
ViSessioninstr;
ViUInt32numInstrs;
ViFindListfindList;
ViStatus status;
char instrResourceString[VI_FIND_BUFLEN];
unsigned char buffer[100];
int i;
/** First we must call viOpenDefaultRM to get the manager
* handle. We will store this handle in defaultRM.*/
status=viOpenDefaultRM (&defaultRM);
if (status<VI_SUCCESS)
{
printf ("Could not open a session to the VISA Resource Manager!\n");
return status;
}
/* Find all the USB TMC VISA resources in our system and store the number of
resources in the system in numInstrs.*/
status = viFindRsrc (defaultRM, "USB?*INSTR", &findList, &numInstrs,
instrResourceString);
if (status<VI_SUCCESS)
{
printf ("An error occurred while finding resources.\nPress 'Enter' to
continue.");
fflush(stdin);
getchar();
viClose (defaultRM);
return status;
}
/** Now we will open VISA sessions to all USB TMC instruments.
SDL1000X Programming Guide 60
* We must use the handle from viOpenDefaultRM and we must
* also use a string that indicates which instrument to open. This
* is called the instrument descriptor. The format for this string
* can be found in the function panel by right clicking on the
* descriptor parameter. After opening a session to the
* device, we will get a handle to the instrument which we
* will use in later VISA functions. The AccessMode and Timeout
* parameters in this function are reserved for future
* functionality. These two parameters are given the value VI_NULL.*/
for (i=0; i<int(numInstrs); i++)
{
if (i> 0)
printf ("Cannot open a session to the device %d.\n", i+1);
continue;
}
/* * At this point we now have a session open to the USB TMC instrument.
* We will now use the viPrintf function to send the device the string "*IDN?\n",
* asking for the device's identification. */
char * cmmand ="*IDN?\n";
status = viPrintf (instr, cmmand);
if (status<VI_SUCCESS)
{
printf ("Error writing to the device %d.\n", i+1);
status = viClose (instr);
SDL1000X Programming Guide 61
SIGLENT
continue;
}
/** Now we will attempt to read back a response from the device to
* the identification query that was sent. We will use the viScanf
* function to acquire the data.
* After the data has been read the response is displayed.*/
status = viScanf(instr, "%t", buffer);
if (status<VI_SUCCESS)
{
printf ("Error reading a response from the device %d.\n", i+1);
}
else
{
printf ("\nDevice %d: %s\n", i+1, buffer);
}
status = viClose (instr);
}
/** Now we will close the session to the instrument using
* viClose. This operation frees all system resources. */
status = viClose (defaultRM);
printf("Press 'Enter' to exit.");
fflush(stdin);
getchar();
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
Usbtmc_test();
return 0;
}
SDL1000X Programming Guide 62
(2)TCP/IP access code:
Write a function TCP_IP_Test.
int TCP_IP_Test(char *pIP)
{
char outputBuffer[VI_FIND_BUFLEN];
ViSession defaultRM, instr;
ViStatus status;
ViUInt32 count;
ViUInt16 portNo;
/* First we will need to open the default resource manager. */
status = viOpenDefaultRM (&defaultRM);
if (status < VI_SUCCESS)
SIGLENT
{
printf("Could not open a session to the VISA Resource Manager!\n");
}
/* Now we will open a session via TCP/IP device */
char head[256] ="TCPIP0::";
char tail[] ="::INSTR";
char resource [256];
strcat(head,pIP);
strcat(head,tail);
status = viOpen (defaultRM, head, VI_LOAD_CONFIG, VI_NULL, &instr);
if (status < VI_SUCCESS)
{
printf ("An error occurred opening the session\n");
viClose(defaultRM);
}
status = viPrintf(instr, "*idn?\n");
status = viScanf(instr, "%t", outputBuffer);
if (status < VI_SUCCESS)
SDL1000X Programming Guide 63
SIGLENT
{
printf("viRead failed with error code: %x \n",status);
viClose(defaultRM);
}else
printf ("\ndata read from device: %*s\n", 0,outputBuffer);
status = viClose (instr);
status = viClose (defaultRM);
return 0;
}
4.1.2 Example of VB
Environment: Win7 32bit system, Microsoft Visual Basic 6.0
The function of this example: Use the NI-VISA, to control the device with
USBTMC and TCP/IP access to do a write and read.
Follow the steps to complete the example:
1、 Open Visual Basic, build a standard application program project (Standard
EXE)
2、 Set the project environment to use the NI-VISA lib, Click the Existing tab of
Project>>Add Existing Item. Search for the visa32.bas file in the include folder
under the NI-VISA installation path and add the file.
This allows the VISA functions and VISA data types to be used in a program.
3、 Add codes:
SDL1000X Programming Guide 64
SIGLENT
(1)USBTMC access code.
Write a function Usbtmc_test:
Private Function Usbtmc_test() As Long
' This code demonstrates sending synchronous read & write commands
' to an USB Test & Measurement Class (USBTMC) instrument using
' NI-VISA
' The example writes the "*IDN?\n" string to all the USBTMC
' devices connected to the system and attempts to read back
' results using the write and read functions.
' The general flow of the code is
' Open Resource Manager
' Open VISA Session to an Instrument
' Write the Identification Query Using viWrite
' Try to Read a Response With viRead
' Close the VISA Session
Const MAX_CNT = 200
Dim defaultRM As Long
Dim instrsesn As Long
Dim numlnstrs As Long
Dim findList As Long
Dim retCount As Long
Dim writeCount As Long
Dim status As Long
Dim instrResourceString As String * VI_FIND_BUFLEN
Dim buffer As String * MAX_CNT
Dim i As Integer
' First we must call viOpenDefaultRM to get the manager
' handle. We will store this handle in defaultRM.
status = viOpenDefaultRM(defaultRM)
If (status < VI_SUCCESS) Then
SDL1000X Programming Guide 65
SIGLENT
Debug.Print "Could not open a session to the VISA Resource
Manager!"
Usbtmc_test = status
Exit Function
End If
' Find all the USB TMC VISA resources in our system and store the
' number of resources in the system in numInstrs.
status = viFindRsrc(defaultRM, "USB?*INSTR", findList, numlnstrs,
instrResourceString)
If (status < VI_SUCCESS) Then
Debug.Print "An error occurred while finding resources."
viClose (defaultRM)
Usbtmc_test = status
Exit Function
End If
' Now we will open VISA sessions to all USB TMC instruments.
' We must use the handle from viOpenDefaultRM and we must
' also use a string that indicates which instrument to open. This
' is called the instrument descriptor. The format for this string
' can be found in the function panel by right clicking on the
' descriptor parameter. After opening a session to the
' device, we will get a handle to the instrument which we
' will use in later VISA functions. The AccessMode and Timeout
' parameters in this function are reserved for future
' functionality. These two parameters are given the value VI_NULL.
For i = 0 To numInstrs
If (i > 0) Then
status = viFindNext(findList, instrResourceString)
End If
status = viOpen(defaultRM, instrResourceString, VI_NULL, VI_NULL,
SDL1000X Programming Guide 66
SIGLENT
instrsesn)
If (status < VI_SUCCESS) Then
Debug.Print "Cannot open a session to the device ", i + 1
GoTo NextFind
End If
' At this point we now have a session open to the USB TMC instrument.
' We will now use the viWrite function to send the device the string "*IDN?",
' asking for the device's identification.
status = viWrite(instrsesn, "*IDN?", 5, retCount)
If (status < VI_SUCCESS) Then
Debug.Print "Error writing to the device."
status = viClose(instrsesn)
GoTo NextFind
End If
' Now we will attempt to read back a response from the device to
' the identification query that was sent. We will use the viRead
' function to acquire the data.
' After the data has been read the response is displayed.
status = viRead(instrsesn, buffer, MAX_CNT, retCount)
If (status < VI_SUCCESS) Then
Debug.Print "Error reading a response from the device.", i + 1
Else
Debug.Print i + 1, retCount, buffer
End If
status = viClose(instrsesn)
NextFind:
Next i
' Now we will close the session to the instrument using
SDL1000X Programming Guide 67
SIGLENT
' viClose. This operation frees all system resources.
status = viClose(defaultRM)
Usbtmc_test = 0
End Function
(2)TCP/IP access code:
Write a function TCP_IP_Test.
Private Function TCP_IP_Test(ip As String) As Long
Dim outputBuffer As String * VI_FIND_BUFLEN
Dim defaultRM As Long
Dim instrsesn As Long
Dim status As Long
Dim count As Long
' First we will need to open the default resource manager.
status = viOpenDefaultRM (defaultRM)
If (status < VI_SUCCESS) Then
Debug.Print "Could not open a session to the VISA Resource
Manager!"
TCP_IP_Test = status
Exit Function
End If
' Now we will open a session via TCP/IP device
status = viOpen(defaultRM, "TCPIP0::" + ip + "::INSTR",
VI_LOAD_CONFIG, VI_NULL, instrsesn)
If (status < VI_SUCCESS) Then
Debug.Print "An error occurred opening the session"
viClose (defaultRM)
TCP_IP_Test = status
Exit Function
SDL1000X Programming Guide 68
SIGLENT
End If
status = viWrite(instrsesn, "*IDN?", 5, count)
If (status < VI_SUCCESS) Then
Debug.Print "Error writing to the device."
End If
status = viRead(instrsesn, outputBuffer, VI_FIND_BUFLEN, count)
If (status < VI_SUCCESS) Then
Debug.Print "Error reading a response from the device.", i + 1
Else
Debug.Print "read from device:", outputBuffer
End If
status = viClose(instrsesn)
status = viClose(defaultRM)
TCP_IP_Test = 0
End Function
4.1.3 Example of MATLAB
Environment: Win7 32bit system, MATLAB R2013a
The function of this example: Use the NI-VISA, to control the device with
USBTMC or TCP/IP access to do a write and read.
Follow the steps to complete the example:
1、 Open MATLAB, modify the current directory. In this demo, the current
directory is modified to D:\USBTMC_TCPIP_Demo.
2、 Click File>>New>>Script in the Matlab interface to create an empty M file
3、 Add codes:
(1)USBTMC access code
Write a function Usbtmc_test.
function USBTMC_test()
% This code demonstrates sending synchronous read & write commands
% to an USB Test & Measurement Class (USBTMC) instrument using
% NI-VISA
%Create a VISA-USB object connected to a USB instrument
vu = visa('ni','USB0::0xF4ED::0xEE3A::sdg2000x::INSTR');
SDL1000X Programming Guide 69
SIGLENT
%Open the VISA object created
fopen(vu);
%Send the string "*IDN?",asking for the device's identification.
fprintf(vu,'*IDN?');
%Request the data
outputbuffer = fscanf(vu);
disp(outputbuffer);
%Close the VISA object
fclose(vu);
delete(vu);
clear vu;
end
2)TCP/IP access code.
Write a function TCP_IP_Test:
function TCP_IP_test()
% This code demonstrates sending synchronous read & write commands
% to an TCP/IP instrument using NI-VISA
%Create a VISA-TCPIP object connected to an instrument
%configured with IP address.
vt = visa('ni',['TCPIP0::','10.11.13.32','::INSTR']);
%Open the VISA object created
fopen(vt);
%Send the string "*IDN?",asking for the device's identification.
fprintf(vt,'*IDN?');
%Request the data
outputbuffer = fscanf(vt);
disp(outputbuffer);
%Close the VISA object
fclose(vt);
delete(vt);
clear vt;
end
4.1.4 LabVIEW sample
Environment: Win7 32bit system, LabVIEW 2011
The functions of this example: use the NI-VISA, to control the device with
USBTMC and TCP/IP access to do a write and read.
Follow the steps to complete the example:
1、 Open LabVIEW, create a VI file.
2、 Add controls. Right-click in the Front Panel interface, select and add VISA
resource name, error in, error out and some indicators from the Controls
SDL1000X Programming Guide 70
SIGLENT
column.
3、 Open the Block Diagram interface. Right-click on the VISA resource name
and you can select and add the following functions from VISA Palette from the
pop-up menu: VISA Write, VISA Read, VISA Open and VISA Close.
4、 Connect them as shown in the figure below
5、Select the device resource from the VISA Resource Name list box and run
the program.
In this example, the VI opens a VISA session to a USBTMC device, writes a
command to the device, and reads back the response. In this example, the
specific command being sent is the device ID query. Check with your device
manufacturer for the device command set. After all communication is complete,
the VI closes the VISA session.
6、Communicating with the device via TCP/IP is similar to USBTMC. But you
SDL1000X Programming Guide 71
SIGLENT
need to change VISA Write and VISA Read Function to Synchronous I/O. The
LabVIEW default is asynchronous I/O. Right-click the node and select
Synchronous I/O Mod>>Synchronous from the shortcut menu to write or read
data synchronously.
7、 Connect them as shown in the figure below
8、 Input the IP address and run the program.
SDL1000X Programming Guide 72
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.