background image

 

SSG5000A  Programming Guide                                                                                                                               5 

1   Programming Overview 

The 

SSG5080A

 supports both USB and LAN interfaces. By using these interfaces, in combination 

with  NI-VISA  and  programming  languages,  users  can  remotely  control  the  signal  generator.  The 

instrument comes with an embedded web  interface; VXI-11, Sockets and  Telnet protocols can be 

used to communicate with the signal generator. This chapter introduces how to build communication 

between the signal generator and the PC. It also introduces the remote control capabilities. 

1.1 

 Build Communication 

 

Build Communication Using VISA  

 

1. 

Install NI-VISA 

Before programming, you will need to install NI-VISA, which you can download from the  National 

Instruments  VISA  web  site.  There  are  full  and  Run-Time  Engine  versions  of  NI-VISA.  The  full 

version includes the NI device driver and a tool named NI MAX which is a user interface to control 

the device. The Run-Time Engine version is a smaller file than the full version only includes the NI 

device driver. 

 

For example, you can get NI-VISA 18.0 full version from: 

http://www.ni.com/download/ni-visa-18.0/7597/en/. 

 

You can also download NI-VISA Run-Time Engine 18.0 to your PC and install it as default selection. 

Its installation process is similar with the full version. 

After you downloaded the file you can follow the steps below to install it:  

 

a. 

Double click the NIVISA1800full.exe, dialog shown as below: 

 

Summary of Contents for SSG5080A Series

Page 1: ...SSG5080A Series Signal Generator Programming Guide PG0805A E01A ...

Page 2: ......

Page 3: ...Overview 14 2 1 Command Format 14 2 2 Symbol Instruction 14 2 3 Parameter Type 15 2 4 Command Abbreviation 17 3 SCPI Commands 18 3 1 IEEE Common Commands 18 3 1 1 Identification Query IDN 18 3 1 2 Reset RST 18 3 1 3 Clear Status CLS 19 3 1 4 Standard Event Status Enable ESE 19 3 1 5 Standard Event Status Register Query ESR 19 3 1 6 Operation Complete Query OPC 20 3 1 7 Service Request Enable SRE 2...

Page 4: ...F DAC STAT 27 3 2 13 Ref Osc Code SYSTem REF DAC 27 3 2 14 Ref Osc Code Store SYSTem REF DAC SAVE 28 3 2 15 Ref Osc Code Load SYSTem REF DAC LOAD 28 3 2 16 Reset Ref Osc Code to Default SYSTem REF DAC DEFault 28 3 2 17 GPIB Address SYSTem GPIB 29 3 3 Preset Subsystem 29 3 3 1 Preset SOURce PRESet 29 3 3 2 System Preset SYSTem PRESet 30 3 3 3 Preset Save SYSTem PRESet SAVE 30 3 3 4 Preset Path SYST...

Page 5: ...tistics Value READ POWer 99 3 6 6 Statistics Max Value SENSe POWer STATIStics MAX 99 3 6 7 Statistics Min Value SENSe POWer STATIStics MIN 100 3 6 8 Statistics Mean Value SENSe POWer STATIStics AVG 100 3 6 9 Statistics Count SENSe POWer STATIStics COUNt 100 3 6 10 Statistics Clear SENSe POWer STATIStics CLEAr 101 3 6 11 Auto Zero CALibration ZERO TYPE 101 3 6 12 Zeroing SENSe POWer ZERO 102 3 6 13...

Page 6: ...SENSe POWer LOGGing STATe 106 4 Programming Examples 107 4 1 VISA Examples 107 4 1 1 VC Example 107 4 1 2 VB Example 115 4 1 3 MATLAB Example 123 4 1 4 LabVIEW Example 126 4 2 Socket Examples 128 4 2 1 Python Example 128 4 2 2 Telnet Example 131 ...

Page 7: ...Before programming you will need to install NI VISA which you can download from the National Instruments VISA web site There are full and Run Time Engine versions of NI VISA The full version includes the NI device driver and a tool named NI MAX which is a user interface to control the device The Run Time Engine version is a smaller file than the full version only includes the NI device driver For ...

Page 8: ...installation process will automatically launch after unzipping files If your computer needs to install NET Framework 4 6 2 its setup process will auto start c The NI VISA installing dialog is shown above Click Next to start the installation process ...

Page 9: ...Program Files National Instruments you can change it Click Next dialog shown as above d Click Next twice in the License Agreement dialog select the I accept the above 2 License Agreement s and click Next Start Installation dialog shown e Click Next to run installation f ...

Page 10: ...les For instructions to communicate with a PC through the LAN interface see the User Manual a Connect the USB Device interface at the rear panel of the signal generator and the USB Host interface of the PC using a USB cable Assuming your PC is already turned on turn on your signal generator and your PC will display the Device Setup screen as it automatically installs the device driver as shown bel...

Page 11: ...currently available resources and doesn t require additional software hardware to run Before you can use sockets you must select the signal generator socket port number to use Standard mode Available on port 5025 Use this port for simple programming Telnet mode The telnet SCPI service is available on port 5024 Connecting the signal generator via the USB Host port Refer to the following steps to fi...

Page 12: ...via NI MAX Users can control the signal generator remotely by sending SCPI commands via NI MAX software 1 2 2 1 Using USB Run NI MAX software 1 Click Device and interface at the upper left corner of the software 2 Find the USBTMC device symbol 3 Click Open VISA Test Panel option button then the following interface will appear 4 Click the Input Output option button and click the Query option button...

Page 13: ...and other identification information 1 2 2 2 Using LAN Add a Network Device and select a VISA TCP IP Resource as shown Run NI MAX software 1 Click Device and interface at the upper left corner of the software 2 Find the Network Devices symbol click Add Network Devices 3 Select Manual Entry of LAN instrument select Next and enter the IP address as shown ...

Page 14: ...SG5000A Programming Guide Click Finish to establish the connection NOTE Leave the LAN Device Name BLANK or the connection will fail 4 After a brief scan the connection should be shown under Network Devices ...

Page 15: ...uide 13 5 Right click on the product and select Open NI VISA Test Panel 6 Click Input Output option button and click Query option button If everything is OK you will see the Read operation information returned as shown below ...

Page 16: ...ommand FREQuency is second 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 A query sent to the instrument indicates that the instrument will have a response string Therefore queriies ask a question and expect a response 2 2 Symbol Instruction The following four symbols are not the cont...

Page 17: ...tical bar is used to separate multiple parameters and when sending the command you can choose one of the parameters For example In the SOURce AM STATe OFF ON 0 1 command the parameters available are OFF ON 0 or 1 4 Braces The parameters in the braces are optional which can be ignored or set for one or more times 2 3 Parameter Type The parameters in the commands introduced in this manual include 6 ...

Page 18: ...or LEV_FREQ 3 Integer Except other notes the parameter can be any integer within the effective value range For example SOURce SWEep STEP POINts value The parameter value can be set to any integer between 2 and 65535 4 Float The parameter can be any value within the effective value range according to the accuracy requirement the default accuracy contains up to 9 digits after the decimal points For ...

Page 19: ...example SYSTem COMMunicate LAN IPADdress xxx xxx xxx xxx The IP address can be set as the string 192 168 1 12 2 4 Command Abbreviation All of the commands are not case sensitive so you can use any of them But if an abbreviation is used all the capital letters in the command must be written completely For example CORRection FLATness COUNt Can be abbreviated to CORR FLAT COUN ...

Page 20: ...rns an instrument identification information string The string contains the manufacturer model number serial number software number FPGA number and CPLD number Menu None Example IDN Return Siglent Technologies SSG5083A SSG5ABAC6R0008 V1 0 0 2 6 Reset RST Command Format RST Instruction This command presets the instrument to a factory defined condition that is appropriate for remote programming oper...

Page 21: ...the standard event status enable register This register monitors I O errors and synchronization conditions such as operation complete request control query error device dependent error execution error command error and power on A summary bit is generated on execution of the command The query returns the state of the standard event status enable register Menu None Example ESE 16 Standard Event Stat...

Page 22: ...struments on the external bus Returns a 1 if the last processing is complete Use this query when there s a need to monitor the command execution status such as a sweep execution Menu None Example OPC Service Request Enable SRE Command Format SRE integer SRE Instruction This command enables the desired bits of the service request enable register The query returns the value of the register indicatin...

Page 23: ...u None Example WAI Self Test Query TST Command Format TST Instruction This query is used by some instruments for a self test Menu None Example TST 3 2 System Subsystem System Time SYSTem TIME Command Format SYSTem TIME hhmmss SYSTem TIME Instruction Set the System time Get the System time Parameter Type String Parameter Range Hours 0 23 minutes 0 59 seconds 0 59 Return String Default None Menu Uti...

Page 24: ...ng Example Set System date SYSTem DATE 20050101 Get System date SYSTem DATE IP Address SYSTem COMMunicate LAN IPADdress Command Format SYSTem COMMunicate LAN IPADdress xxx xxx xxx xxx SYSTem COMMunicate LAN IPADdress Instruction Set the IP address The IP address will be fetched automatically if the IP assignment is set to DHCP Get the IP address Parameter Type String Parameter Range Conforms to th...

Page 25: ...urn Gateway string Default None Menu Utility Interface LAN Setting Gateway Example SYSTem COMMunicate LAN GATeway 192 168 1 1 SYSTem COMMunicate LAN GATeway Subnet Mask SYSTem COMMunicate LAN SMASk Command Format SYSTem COMMunicate LAN SMASk xxx xxx xxx xxx SYSTem COMMunicate LAN SMASk Instruction Set the subnet mask according to the network settings The subnet mask will be set automatically if th...

Page 26: ...Type Enumeration Parameter Range STATIC DHCP Return Enumeration Default None Menu Utility Interface LAN Setting DHCP State Example SYSTem COMMunicate LAN TYPE DHCP SYSTem COMMunicate LAN TYPE Language SYSTem LANGuage Command Format SYSTem LANGuage CHINese ENGLish SYSTem LANGuage Instruction Set language Get language Parameter Type Enumeration Parameter Range CHINese ENGLish Return Enumeration Defa...

Page 27: ...er Range OFF 10S 1MIN 5MIN 15MIN 30MIN 1HOUR 2HOUR Return Enumeration Default OFF Menu Utility Setting Screen Saver Example SYSTem SCReen SAVer 30MIN SYSTem SCReen SAVer Beeper SYSTem ALARm Command Format SYSTem ALARm ON OFF 1 0 SYSTem ALARm Instruction Set system beeper state Get system beeper state Parameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default ON Menu Utility Setting B...

Page 28: ...Parameter Range DFT LAST DFT Default LAST Last Return Enumeration Default DFT Menu Utility Setting Setup Type Example SYSTem PON TYPE DFT SYSTem PON TYPE Power On Line SYSTem POWeron TYPE Command Format SYSTem POWeron TYPE ON OFF 1 0 SYSTem POWeron TYPE Instruction Set the signal generator power on line state Get the signal generator power on line state Parameter Type Boolean Parameter Range ON OF...

Page 29: ...Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu Utility Setting 10M Adjustment Example SYSTem REF DAC STAT ON SYSTem REF DAC STAT Ref Osc Code SYSTem REF DAC Command Format SYSTem REF DAC value SYSTem REF DAC Instruction Set ref osc code Get ref osc code Parameter Type Int Parameter Range 0 65535 Return Int Default 26214 Menu Utility Setting 10M Adjustment Ref Osc Code Example SYSTem REF ...

Page 30: ... U disk3 test dac Ref Osc Code Load SYSTem REF DAC LOAD Command Format SYSTem REF DAC LOAD file_name Instruction Load existing ref osc code files Parameter Type String Parameter Range None Return None Default None Menu Utility Setting 10M Adjustment Recall Ref Osc Setting Example SYSTem REF DAC LOAD U disk3 test dac Reset Ref Osc Code to Default SYSTem REF DAC DEFault Command Format SYSTem REF DAC...

Page 31: ...s of the signal source Get GPIB address of the signal source Parameter Type Integer Parameter Range 1 30 Return Integer Default 18 Menu Utility Interface GPIB Address Example SYSTem GPIB 10 SYSTem GPIB 3 3 Preset Subsystem Preset SOURce PRESet Command Format SOURce PRESet Instruction Presets all parameters which are related to the selected signal path Parameter Type None Return None Default None M...

Page 32: ...ation SYSTem PRESet TYPE DFT SYSTem PRES Or preset signal generator to current configuration SYSTem PRESet TYPE USER SYSTem PRESet SAVE SYSTem PRES Or preset signal generator to configuration saved in an existing xml file SYSTem PRESet TYPE USER SYSTem PRESet PATH Local test xml SYSTem PRES Preset Save SYSTem PRESet SAVE Command Format SYSTem PRESet SAVE Instruction Save status for preset when pre...

Page 33: ...m PRESet PATH Local test xml SYSTem PRESet PATH U disk1 test xml Preset Type SYSTem PRESet TYPE Command Format SYSTem PRESet TYPE DFT USER SYSTem PRESet TYPE Instruction Uses this command to preset the signal generator to default or user Get preset type Parameter Type Enumeration Parameter Range DFT Default USER Custom Configuration Return Enumeration Default DFT Menu Utility Setting Preset Type E...

Page 34: ...one Default None Menu Utility Setting Factory Reset Example SYSTem FDEFault Reset Clear SYSTem RESet CLEar Command Format SYSTem RESet CLEar Instruction Set both the measure and setting parameters to the factory settings and at the same time clear the files saved by the user in the Local folder Parameter Type None Parameter Range None Return None Default None Menu Utility Setting Reset Clear Examp...

Page 35: ... RF output Get the state of the RFoutput Parameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu RF Example OUTPut ON OUTPut RF Output SOURce OUTPut Command Format SOURce OUTPut ON OFF 1 0 Instruction Activate Deactivate the RF output Parameter Type Boolean Parameter Range ON OFF 1 0 Return None Default 0 Menu RF Example SOURce OUTPut ON ...

Page 36: ...ault Hz Parameter Range Frequency offset Full frequency range Return Float unit Hz Default Maximum frequency Menu Freq Example FREQuency DISPlay 2 MHz FREQuency DISPlay 3 5 1 2 Frequency SOURce FREQuency Command Format SOURce FREQuency freq SOURce FREQuency Instruction Set the frequency of the RF output signal Get the frequency of the RF output signal Parameter Type Float unit Hz kHz MHz GHz Defau...

Page 37: ...e Float unit Hz kHz MHz GHz Default Hz Parameter Range 200 GHz 200 GHz Return Float unit Hz Default 0 Hz Menu FREQ Freq Offset Example FREQuency OFFSet 2 MHz FREQuency OFFSet 3 5 1 4 Phase Offset SOURce PHASe Command Format SOURce PHASe phase SOURce PHASe Instruction Set the phase of the RF output signal Get the phase of the RF output signal Parameter Type Float unit deg Parameter Range 360 deg 36...

Page 38: ...se delta display Example PHASe RESet PHASe REF SOURce POWer Subsystem 3 5 2 1 Level Display SOURce POWer POWer Command Format SOURce POWer POWer power SOURce POWer POWer Instruction Set the RF level display on parameter bar Get the RF level display from the parameter bar Parameter Type Float unit dBm dBuV uV mV V nW uW mW W Default dBm Parameter Range Level Offset Full power range Return Float uni...

Page 39: ... Float unit dBm Default 130 dBm Menu LEVEL Level Example POWer 2 POWer 3 5 2 3 Level SOURce POWer LEVel IMMediate AMPLitude Command Format SOURce POWer LEVel IMMediate AMPLitude power SOURce POWer LEVel IMMediate AMPLitude Instruction Set the RF output level Get the RF output level Parameter Type Float unit dBm dBuV uV mV V nW uW mW W Default dBm Parameter Range Please refer to SSG5000A datasheet ...

Page 40: ...OWer OFFSet 2 POWer OFFSet 3 5 2 5 ALC State SOURce POWer ALC Command Format SOURce POWer ALC ON OFF AUTO SOURce POWer ALC Instruction Activate deactivate automatic level control Query ALC state Parameter Type Enumeration Parameter Range ON OFF AUTO ON Internal level control is permanently activated OFF Internal level control is deactivated Sample Hold mode is activated AUTO Internal level control...

Page 41: ... Flatness Example CORRection FLATness ON CORRection 3 5 2 7 Flatness List Add Row SOURce CORRection FLATness PAIR Command Format SOURce CORRection FLATness PAIR freq power Instruction Insert a new row in the flatness list Parameter Type Float Float Parameter Range Freq Full freq range Power Full power range Return None Default None Menu LEVEL Flatness Add Example CORRection FLATness PAIR 3 MHz 3 3...

Page 42: ...COUNt Command Format SOURce CORRection FLATness COUNt Instruction Indicates the total count of the number of elements in the flatness correction table Parameter Type None Parameter Range None Return Integer Default 0 Menu LEVEL Flatness Example CORRection FLATness COUNt 3 5 2 10 Flatness List Store SOURce CORRection STORe Command Format SOURce CORRection STORe file_name Instruction Save the correc...

Page 43: ... 2 12 Flatness List Clear SOURce CORRection FLATness PRESet Command Format SOURce CORRection FLATness PRESet Instruction Clear the displayed flatness correction list Parameter Type None Parameter Range None Default None Menu LEVEL Flatness Clear Example CORRection FLATness PRESet 3 5 2 13 Flatness List Fill Type SOURce CORRection FLATness FILL TYPE Command Format SOURce CORRection FLATness FILL TY...

Page 44: ...ency when you want to fill the flatness list with the sensor and filling type is Manual Step Parameter Type Float unit Hz kHz MHz GHz Default Hz Parameter Range Full frequency range Return Float unit Hz Default Maximum frequency Menu LEVEL Flatness Setting Fill Type Manual Step Start Freq Example CORRection FLATness STARtfreq 200 MHz CORRection FLATness STARtfreq 3 5 2 15 Flatness List Stop Freq S...

Page 45: ...uction Set the fill space in Manual Step Fill Type Get the fill space in Manual Step Fill Type Parameter Type Enumeration Parameter Range LINear LOGarithmic Return Enumeration Default LINear Menu LEVEL Flatness Setting Fill Type Manual Step Fill Space Example CORRection FLATness SPACe LINear CORRection FLATness SPACe 3 5 2 17 Flatness List Linear Step SOURce CORRection FLATness LINStep Command For...

Page 46: ...cy step in Manual Step Fill Type Parameter Type Float unit Parameter Range None Return Float unit Default None Menu LEVEL Flatness Setting Fill Type Manual Step Step Log Example CORRection FLATness LOGStep 20 CORRection FLATness LOGStep 3 5 2 19 Flatness List Points SOURce CORRection FLATness POINt Command Format SOURce CORRection FLATness POINt points SOURce CORRection FLATness POINt Instruction ...

Page 47: ...ter Type None Parameter Range None Return None Default None Menu LEVEL Flatness Setting Fill Flatness with Sensor Example CORRection CSET DATA SONCe 3 5 2 21 Level Control SOURce POWer SPC STATe Command Format SOURce POWer SPC STATe ON OFF 1 0 SOURce POWer SPC STATe Instruction Activate Deactivate power control using an external USB power sensor Get the level control state Parameter Type Boolean P...

Page 48: ... 0 Menu SENSOR Level Control Example SENSe LEV CTL STATe OFF SENSe LEV CTL STATe 3 5 2 23 Target Level SOURce POWer SPC TARGet Command Format SOURce POWer SPC TARGet power SOURce POWer SPC TARGet Instruction Set the nominal level expected at the input of the sensor Get the nominal level expected at the input of the sensor Parameter Type Float unit dBm dBuV uV mV V nW uW mW W Default dBm Parameter ...

Page 49: ...r Range 120 dBm 20 dBm Return Float unit dBm Default 0 dBm Menu SENSOR Level Control Target Level Example SENSe SPC TARGet 6 SENSe SPC TARGet 3 5 2 25 Level Limit SOURce POWer LIMit Command Format SOURce POWer LIMit power SOURce POWer LIMit Instruction Set the upper limit for the RF output power Get the upper limit for the RF output power Parameter Type Float unit dBm dBuV uV mV V nW uW mW W Defau...

Page 50: ... 120 dBm 20 dBm Return Float unit dBm Default 0 dBm Menu SENSOR Level Control Level Limit Example SENSe LIMit 2 SENSe LIMit 3 5 2 27 Catch Range SOURce POWer SPC CRANge Command Format SOURce POWer SPC CRANge power SOURce POWer SPC CRANge Instruction Set the capture range of the control system Get the capture range of the control system Parameter Type Float unit dB Parameter Range 0 dB 50 dB Return...

Page 51: ...e 0 dB 50 dB Return Float unit dB Default 0 dB Menu SENSOR Level Control Catch Range Example SENSe SPC CRANge 10 SENSe SPC CRANge SOURce SWEep Subsystem 3 5 3 1 Sweep State SOURce SWEep STATe Command Format SOURce SWEep STATe OFF FREQuency LEVel LEV_FREQ SOURce SWEep STATe Instruction Activate frequency or and level sweep Parameter Type Enumeration Parameter Range OFF FREQuency LEVel LEV_FREQ Retu...

Page 52: ... TYPE STEP SWEep TYPE 3 5 3 3 Start Frequency SOURce SWEep STEP STARt FREQuency Command Format SOURce SWEep STEP STARt FREQuency freq SOURce SWEep STEP STARt FREQuency Instruction Set the start frequency for the sweep mode Get the start frequency for the sweep mode Parameter Type Float unit Hz kHz MHz GHz Default Hz Parameter Range Full frequency range Return Float unit Hz Default Maximum frequenc...

Page 53: ...z Default Maximum frequency Menu SWEEP Step Sweep Stop Freq Example SWEep STEP STOP FREQuency 1 GHz SWEep STEP STOP FREQuency 3 5 3 5 Start Level SOURce SWEep STEP STARt LEVel Command Format SOURce SWEep STEP STARt LEVel level SOURce SWEep STEP STARt LEVel Instruction Set the start level for the sweep mode Get the start level for the sweep mode Parameter Type Float unit dBm dBuV uV mV V nW uW mW W...

Page 54: ...vel range Return Float unit dBm Default 130 dBm Menu SWEEP Step Sweep Stop Level Example SWEep STEP STOP LEVel 0 dBm SWEep STEP STOP LEVel 3 5 3 7 Dwell Time SOURce SWEep STEP DWELl Command Format SOURce SWEep STEP DWELl time SOURce SWEep STEP DWELl Instruction Set the duration of the individual sweep steps Get the duration of the individual sweep steps Parameter Type Float unit ns us ms s Paramet...

Page 55: ... Default 11 Menu SWEEP Step Sweep Sweep Points Example SWEep STEP POINts 2 SWEep STEP POINts 3 5 3 9 Sweep Shape SOURce SWEep STEP SHAPe Command Format SOURce SWEep STEP SHAPe TRIangle SAWtooth SOURce SWEep STEP SHAPe Instruction Select the waveform shape of the sweep signal Get the waveform shape of the sweep signal Parameter Type Enumeration Parameter Range TRIangle SAWtooth Return Enumeration D...

Page 56: ...EP Step Sweep Sweep Space Example SWEep STEP SPACe LOGarithmic SWEep STEP SPACe 3 5 3 11 Sweep Step in Linear Sweep Space SOURce SWEep FREQuency STEP LINear Command Format SOURce SWEep FREQuency STEP LINear freq SOURce SWEep FREQuency STEP LINear Instruction Set the sweep step in linear sweep space Get the sweep step in linear sweep space Parameter Type Float unit Hz kHz MHz GHz Default Hz Paramet...

Page 57: ...one Return Float unit Default 0 Menu SWEEP Step Sweep Freq Step Log Example SWEep STEP LOGarithmic 20 SWEep STEP LOGarithmic 3 5 3 13 Sweep List Add Row SOURce SWEep LIST ADDList Command Format SOURce SWEep LIST ADDList freq level time Instruction Insert a new row to the list Parameter Type Freq Float unit Hz kHz MHz GHz Default Hz Level Float unit dBm Time Float unit ns us ms s Default s Paramete...

Page 58: ...le SWEep LIST DELete 1 3 5 3 15 Sweep List Edit SOURce SWEep LIST CHANGe Command Format SOURce SWEep LIST CHANGe row freq power time Instruction Edit sweep list pair value Parameter Type Row Integer Freq Float unit Hz kHz MHz GHz Power Float unit dBm dBmV dBuV V W Default dBm Time Float unit ns us ms s Default s Parameter Range Raw 1 count of pair Freq Full frequency range Power Full level range t...

Page 59: ... SWEep LIST LIST Command Format SOURce SWEep LIST LIST begin_ row end_row Instruction View starting row to end row data Parameter Type Integer Integer Parameter Range 1 to count of sweep list Return String Default None Menu SWEEP List Sweep Example SWEep LIST LIST 1 3 3 5 3 18 Sweep List Clear SOURce SWEep LIST INITialize PRESet Command Format SOURce SWEep LIST INITialize PRESet Instruction Restor...

Page 60: ...ne Parameter Range None Return None Default None Menu SWEEP List Sweep Import Example SWEep LIST INITialize FSTep 3 5 3 20 Sweep List Load SOURce SWEep LOAD Command Format SOURce CORRection LOAD file_name Instruction Load existing sweep list file Parameter Type String Parameter Range None Return None Default None Menu SWEEP List Sweep Load Example SWEep LOAD U disk3 test lsw 3 5 3 21 Sweep List St...

Page 61: ...ct the direction for sweep Parameter Type Enumeration Parameter Range FWD REV Return Enumeration Default FWD Menu SWEEP Direction Example SWEep DIRect REV SWEep DIRect 3 5 3 23 Sweep Mode SOURce SWEep MODE Command Format SOURce SWEep MODE CONTinue SINGle SOURce SWEep MODE Instruction Set the cycle mode of the sweep Get the cycle mode of the sweep Parameter Type Enumeration Parameter Range CONTinue...

Page 62: ...Return None Default None Menu SWEEP Execute single sweep Example SWEep EXECute 3 5 3 25 Trigger Mode SOURce SWEep SWEep TRIGger TYPE Command Format SOURce SWEep SWEep TRIGger TYPE AUTO KEY BUS EXT SOURce SWEep SWEep TRIGger TYPE Instruction Select the trigger mode Get the trigger mode Parameter Type Enumeration Parameter Range AUTO KEY BUS EXT Return Enumeration Default AUTO Menu SWEEP Trigger Mod...

Page 63: ...gger Example SWEep POINt TRIGger TYPE KEY SWEep POINt TRIGger TYPE 3 5 3 27 Bus Trigger SOURce TRG Command Format SOURce TRG Instruction When the trigger mode or point trigger mode is Bus send this command to make the signal source start sweeping Parameter Type None Parameter Range None Return None Default None Menu None Example TRG 3 5 3 28 Trigger Slope SOURce INPut TRIGger SLOPe Command Format ...

Page 64: ...Trigger Slope Example INPut TRIGger SLOPe NEGative INPut TRIGger SLOPe 3 5 3 29 Get Sweep Point SOURce SWEep CURRent Data Command Format SOURce SWEep CURRent Data Instruction Get the currently sweep point The format is index freq level time Parameter Type None Parameter Range None Return String Index interger freq Hz level dBm time s Default None Menu None Example SWEep CURRent Data Return 1 1e 09...

Page 65: ...ameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu MOD Example MODulation ON MODulation 3 5 4 2 Modulation State OUTPut MODulation STATe Command Format OUTPut MODulation STATe ON OFF 1 0 OUTPut MODulation STATe Instruction Switch modulation on and off Get the modulation state Parameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu MOD Example OUTPu...

Page 66: ...Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu AM AM State Example AM STATe ON AM STATe 3 5 5 2 AM Shape SOURce AM WAVEform Command Format SOURce AM WAVEform SINE SQUAre SOURce AM WAVEform Instruction Set the AM modulation waveform Get the AM modulation waveform Parameter Type Enumeration Parameter Range SINE SQUAre Return Enumeration Default SINE Menu AM AM Shape Example AM...

Page 67: ...Enumeration Parameter Range INTernal EXTernal INT EXT Return Enumeration Default INTernal Menu AM AM Source Example AM SOURce EXTernal AM SOURce 3 5 5 4 AM Depth SOURce AM DEPTh Command Format SOURce AM DEPTh value SOURce AM DEPTh Instruction Set the overall modulation depth of the amplitude modulation in percent Get the AM depth Parameter Type Float Parameter Range 0 1 100 Return Float Default 50...

Page 68: ...Hz Default Hz Parameter Range Sine 0 01 Hz 100 kHz Square 0 01 Hz 20 kHz Return Float unit Hz Default 1 kHz Menu AM AM Rate Example AM FREQuency 10 kHz AM FREQuency 3 5 5 6 AM Sensitivity SOURce AM SENSitivity Command Format SOURce AM SENSitivity Instruction Query the input sensitivity of the external modulation input in V Parameter Type None Parameter Range None Return Float unit V Default 0 V Me...

Page 69: ...eturn Boolean Default 0 Menu FM FM State Example FM STATe ON FM STATe 3 5 6 2 FM Source SOURce FM SOURce Command Format SOURce FM SOURce INT1 INT2 INT1 INT2 EXTernal INT1 EXT DUAL SOURce FM SOURce Instruction Select the modulation signal source for frequency modulation FM Get the FM Source Parameter Type Enumeration Parameter Range INT1 INT2 INT1 INT2 EXTernal INT1 EXT DUAL Return Enumeration Defa...

Page 70: ...rn Enumeration Default SINE Menu FM FM Shape1 Example FM1 WAVEform SQUAre FM1 WAVEform 3 5 6 4 FM Deviation1 SOURce FM1 DEViation Command Format SOURce FM1 DEViation value SOURce FM1 DEViation Instruction Set the deviation value of the FM waveform1 when the FM Source includes Int1 Get the deviation value of the FM waveform1 when the FM Source includes Int1 Parameter Type Float unit Hz kHz MHz GHz ...

Page 71: ...Range SQUAre SAWTooth TRIangle 0 01 Hz 20 kHz SINE 0 01 Hz 100 kHz Return Float unit Hz Default 10 kHz Menu FM FM Rate1 Example FM1 FREQuency 40 kHz FM1 FREQuency 3 5 6 6 FM Phase1 SOURce FM1 PHASe Command Format SOURce FM1 PHASe value SOURce FM1 PHASe Instruction Set the phase of the FM waveform1 when the FM Source is Int1 Int2 or Dual Get the phase of the FM waveform1 when the FM Source is Int1 ...

Page 72: ...n Enumeration Default SINE Menu FM FM Shape2 Example FM2 WAVEform SAWTooth FM2 WAVEform 3 5 6 8 FM Deviation2 SOURce FM2 DEViation Command Format SOURce FM2 DEViation value SOURce FM2 DEViation Instruction Set the deviation value of the FM waveform2 when the FM Source includes Int2 Get the deviation value of the FM waveform2 when the FM Source includes Int2 Parameter Type Float unit Hz kHz MHz GHz...

Page 73: ...Range SQUAre SAWTooth TRIangle 0 01 Hz 20 kHz SINE 0 01 Hz 100 kHz Return Float unit Hz Default 10 kHz Menu FM FM Rate2 Example FM2 FREQuency 15 kHz FM2 FREQuency 3 5 6 10 FM Phase2 SOURce FM2 PHASe Command Format SOURce FM2 PHASe value SOURce FM2 PHASe Instruction Set the phase of the FM waveform2 when the FM Source is Int1 Int2 or Dual Get the phase of the FM waveform2 when the FM Source is Int1...

Page 74: ...e FM Source is Dual Parameter Type Float Parameter Range 0 100 Return Float Default 50 Menu FM Int1 Proportion Example FM1 PROPortion 0 6 FM1 PROPortion 3 5 6 12 FM Sensitivity1 SOURce FM1 SENSitivity Command Format SOURce FM1 SENSitivity Instruction Displays the input sensitivity of the FM EXT input in Hz V when the FM Source includes Ext Parameter Type None Parameter Range None Return Float unit...

Page 75: ...ameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu PM PM State Example PM STATe ON PM STATe 3 5 7 2 PM Shape SOURce PM WAVEform Command Format SOURce PM WAVEform SINE SQUAre SOURce PM WAVEform Instruction Selects the shape of PM Get the shape of PM Parameter Type Enumeration Parameter Range SINE SQUAre Return Enumeration Default SINE Menu PM PM Shape Example PM WAVEform S...

Page 76: ...eration Default INTernal Menu PM PM Source Example PM SOURce EXTernal PM SOURce 3 5 7 4 PM Deviation SOURce PM DEViation Command Format SOURce PM DEViation value SOURce PM DEViation Instruction Set the modulation deviation of the phase modulation PM Get the modulation deviation of the phase modulation PM Parameter Type Float unit rad Parameter Range 0 01 rad N 5 rad The value of N please refer to ...

Page 77: ...ange INTernal SQUAre 0 01 Hz 20 kHz SINE 0 01 Hz 100 kHz INT EXT SQUAre 0 01 Hz 20 kHz SINE 0 01 Hz 100 kHz Return Float unit Hz Default 10 kHz Menu PM PM Rate Example PM FREQuency 10 kHz PM FREQuency 3 5 7 6 PM Sensitivity SOURce PM SENSitivity Command Format SOURce PM SENSitivity Instruction Query the input sensitivity of the EXT MOD input in rad v Parameter Type None Parameter Range None Return...

Page 78: ...pe Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu PULSE Pulse State Example PULM STAT ON PULM STATe 3 5 8 2 Pulse Out SOURce PULM OUT STATe Command Format SOURce PULM OUT STATe ON OFF 1 0 SOURce PULM OUT STATe Instruction Configures the signal at the PULSE OUT connector Get the Pulse Output status Parameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu PUL...

Page 79: ...ernal Return Enumeration Default INTernal Menu PULSE Pulse Source Example PULM SOUR INTernal PULM SOURce 3 5 8 4 Pulse Source SOURce PULM SOURce INT Command Format SOURce PULM SOURce INT INTernal EXTernal SOURce PULM SOURce INT Instruction Select the source for the pulse modulation signal Get the source for the pulse modulation signal Parameter Type Enumeration Parameter Range INTernal EXTernal Re...

Page 80: ...lse Out Polarity Example PULM POL INV PULM POLarity 3 5 8 6 Pulse Mode SOURce PULM MODE Command Format SOURce PULM MODE SINGle DOUBle PTRain SOURce PULM MODE Instruction Set the mode of the pulse generator Get the mode of the pulse generator Parameter Type Enumeration Parameter Range SINGle DOUBle PTRain SINGle Enables single pulse generation DOUBle Enables double pulse generation The two pulses a...

Page 81: ...Type Float unit ns us ms s and default is s Parameter Range 40 ns 300 s Return Float unit s Default 10 ms Menu PULSE Pulse Period Example PULM PER 220 us PULM PER 3 5 8 8 Pulse Period SOURce PULM INT 1 PERiod Command Format SOURce PULM INT 1 PERiod value SOURce PULM INT 1 PERiod Instruction Set the period of the generated pulse when pulse mode is Single or Double The period determines the repetiti...

Page 82: ...rameter Type Float unit ns us ms s and default is s Parameter Range 20 ns 300 s Return Float unit s Default 2 ms Menu PULSE Pulse Width Example PULM WIDT 33 us PULM WIDT 3 5 8 10 Pulse Width SOURce PULM INT 1 PWIDth Command Format SOURce PULM INT 1 PWIDth value SOURce PULM INT 1 PWIDth Instruction Set the width of the generated pulse when pulse mode is Single or Double Get the width of the generat...

Page 83: ... when pulse mode is Double Parameter Type Float unit ns us ms s and default is s Parameter Range 20 ns 300 s Return Float unit s Default 4 ms Menu PULSE Double Pulse Delay Example PULM DOUBle DELay 2 ms PULM DOUBle DELay 3 5 8 12 2 Width SOURce PULM DOUBle WIDTh Command Format SOURce PULM DOUBle WIDTh time SOURce PULM DOUBle WIDTh Instruction Set the width of the second pulse in the case of double...

Page 84: ... 1 N which is the specified row number N the length of the current pulse train Return None Default None Menu PULSE Pulse Train Add Example PULM TRAin PAIR 1 3 5 8 14 Pulse Train Delete SOURce PULM TRAin DELete Command Format SOURce PULM TRAin DELete row Instruction Delete the train pair Parameter Type Integer Parameter Range 1 N which is the specified row number N the length of the current pulse t...

Page 85: ...ample PULM TRAin DATA ONTIme 1 10 ms 3 5 8 16 Pulse Train Edit Off Time SOURce PULM TRAin DATA OFFTime Command Format SOURce PULM TRAin DATA OFFTime raw off_time Instruction Edit train off time value Parameter Type raw integer off_time float unit ns us ms s and default is s Parameter Range raw 1 count of pair off_time 20ns 300s Return None Default None Menu PULSE Pulse Train Example PULM TRAin DAT...

Page 86: ...ion Edit train pair value Parameter Type raw integer on_time float unit ns us ms s and default is s off_time float unit ns us ms s and default is s count integer Parameter Range raw 1 count of pair on_time 20ns 300s off_time 20ns 300s count 1 65535 Return None Default None Menu PULSE Pulse Train Example PULM TRAin CHANGe 2 3 ms 500 ns 4 3 5 8 19 List Pulse Train SOURce PULM TRAin LIST Command Form...

Page 87: ...LM TRAin COUNt Command Format SOURce PULM TRAin COUNt Instruction Get count of train list Parameter Type None Parameter Range None Return Integer Default 1 Menu PULSE Pulse Train Example PULM TRAin COUNt 3 5 8 21 Pulse Train Clear SOURce PULM TRAin CLEAr Command Format SOURce PULM TRAin CLEAr Instruction Clear train pair list Parameter Type None Parameter Range None Return None Default None Menu P...

Page 88: ...lse Train Store SOURce PULM TRAin STORE Command Format SOURce PULM TRAin STORE file Instruction Store train pair list Parameter Type String Parameter Range None Return None Default None Menu PULSE Pulse Train Save Example PULM TRAin STORE test pulstrn PULM TRAin STORE U disk1 test pulstrn 3 5 8 24 Trigger Out SOURce PULM TRIGger STATe Command Format SOURce PULM TRIGger STATe ON OFF 1 0 SOURce PULM...

Page 89: ... trigger mode for pulse modulation Parameter Type Enumeration Parameter Range AUTO KEY EXTernal EGATe Return Enumeration Default AUTO Menu PULSE Pulse Trigger Example PULM TRIG MODE EXTernal PULM TRIGger MODE 3 5 8 26 Trig Polarity SOURce PULM TRIGger EXTernal GATE POLarity Command Format SOURce PULM TRIGger EXTernal GATE POLarity NORMal INVerted SOURce PULM TRIGger EXTernal GATE POLarity Instruct...

Page 90: ...eter Range 140 ns 300 s Return Float unit s Default 140 ns Menu PULSE Trig Delay Example PULM DEL 30 ms PULM DELay 3 5 8 28 Trig Slope SOURce PULM TRIGger EXTernal SLOPe Command Format SOURce PULM TRIGger EXTernal SLOPe NEGative POSitive SOURce PULM TRIGger EXTernal SLOPe Instruction Set the polarity of the active slope of an applied trigger at the PULSE EXT connector Get the polarity of the activ...

Page 91: ...ut state Parameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu LF LF State Example LFOutput ON LFOutput 3 5 9 2 LF Level SOURce LFOutput VOLTage Command Format SOURce LFOutput VOLTage volt SOURce LFOutput VOLTage Instruction Set the voltage of the LF output signal Get the voltage of the LF output signal Parameter Type Float unit dBm uVpp mVpp Vpp nW uW mW Default Vpp Para...

Page 92: ... V Parameter Range Return Float unit V Default 0 V Menu LF LF Offset Example LFOutput OFFSEt 1 V LFOutput OFFSEt 3 5 9 4 LF Frequency SOURce LFOutput FREQuency Command Format SOURce LFOutput FREQuency freq SOURce LFOutput FREQuency Instruction Set LF out put frequency Get LF out put frequency If the signal source is set to Internal the instrument performs the analog modulations AM FM PM with this ...

Page 93: ...pe Enumeration Parameter Range SINE SQUare TRIangle SAWTooth DC Return Enumeration Default SINE Menu LF LF Shape Example LFOutput SHAPe TRIangle LFOutput SHAPe 3 5 9 6 LF Phase SOURce LFOutput PHASe Command Format SOURce LFOutput PHASe deg SOURce LFOutput PHASe Instruction Set the phase of the LF output signal Get the phase of the LF output signal Parameter Type Float unit deg Parameter Range 360 ...

Page 94: ...er Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu LF Sweep LF State Example LFOutput SWEep 1 LFOutput SWEep 3 5 10 2 Sweep Direction SOURce LFOutput SWEep DIRect Command Format SOURce LFOutput SWEep DIRect UP DOWN SOURce LFOutput SWEep DIRect Instruction Set the sweep direction Get the sweep direction Parameter Type Enumeration Parameter Range UP DOWN Return Enumeration Defa...

Page 95: ...ault 500 Hz Menu LF Sweep Start Freq Example LFOutput SWEep STARt FREQuency 100 LFOutput SWEep STARt FREQuency 3 5 10 4 Stop Freq SOURce LFOutput SWEep STOP FREQuency Command Format SOURce LFOutput SWEep STOP FREQuency freq SOURce LFOutput SWEep STOP FREQuency Instruction Set the stop frequency of sweep mode Get the stop frequency of sweep mode Parameter Type Float unit Hz kHz MHz GHz Default Hz P...

Page 96: ...t Hz Default 1 kHz Menu LF Sweep Center Freq Example LFOutput SWEep CENTer FREQuency 550 LFOutput SWEep CENTer FREQuency 3 5 10 6 Freq Span SOURce LFOutput SWEep SPAN FREQuency Command Format SOURce LFOutput SWEep SPAN FREQuency freq SOURce LFOutput SWEep SPAN FREQuency Instruction Set the center frequency of sweep mode Get the center frequency of sweep mode Parameter Type Float unit Hz kHz MHz GH...

Page 97: ...s Default 1 s Menu LF Sweep Sweep Time Example LFOutput SWEep DWELl 2 s LFOutput SWEep DWELl 3 5 10 8 Trigger Mode SOURce LFOutput SWEep TRIGger TYPE Command Format SOURce LFOutput SWEep TRIGger TYPE AUTO KEY BUS EXT SOURce LFOutput SWEep TRIGger TYPE Instruction Select the LF frequency sweep trigger mode Get the LF frequency sweep trigger mode Parameter Type Enumeration Parameter Range AUTO KEY B...

Page 98: ...Return Enumeration Default POS Menu LF Sweep Trigger Slope Example LFOutput SWEep XPOLar POS LFOutput SWEep XPOLar 3 5 10 10 Sweep Shape SOURce LFOutput SWEep SHAPe Command Format SOURce LFOutput SWEep SHAPe TRIangle SAWTooth SOURce LFOutput SWEep SHAPe Instruction Select the waveform shape of the sweep signal Get the waveform shape of the sweep signal Parameter Type Enumeration Parameter Range TR...

Page 99: ... of the frequency sweep intervals Parameter Type Enumeration Parameter Range LINear LOGarithmic Return Enumeration Default LINear Menu LF Sweep Sweep Space Example LFOutput SWEep SPACing LOGarithmic LFOutput SWEep SPACing 3 6 Sense Subsystem Sensor Info SENSe POWer TYPE Command Format SENSe POWer TYPE Instruction Query the type of sensor connected to the POWER SENSOR connector Parameter Type None ...

Page 100: ...STATus ON SENSe STATus Measurement SENSe POWer VALue Command Format SENSe POWer VALue Instruction Indicate the current reading of the sensor Parameter Type None Parameter Range None Return Float unit dBm Default None Menu SENSOR Measurement Example SENSe VALue Statistics State SENSe POWer STATIStics STATe Command Format SENSe POWer STATIStics STATe ON OFF 1 0 SENSe POWer STATIStics STATe Instructi...

Page 101: ...uction Indicate the measured mean value and maximum value of power meter readings Parameter Type None Parameter Range None Return String Default None Menu SENSOR Statistics Example READ Statistics Max Value SENSe POWer STATIStics MAX Command Format SENSe POWer STATIStics MAX Instruction Indicate the measured maximum value of power meter readings Parameter Type None Parameter Range None Return Floa...

Page 102: ...SOR Statistics Example SENSe STATIStics MIN Statistics Mean Value SENSe POWer STATIStics AVG Command Format SENSe POWer STATIStics AVG Instruction Indicate the measured mean value of power meter readings Parameter Type None Parameter Range None Return Float unit dBm Default None Menu SENSOR Statistics Example SENSe STATIStics AVG Statistics Count SENSe POWer STATIStics COUNt Command Format SENSe P...

Page 103: ...ar the statistics counter of power meter Parameter Type None Parameter Range None Return None Default None Menu SENSOR Statistics Example SENSe STATIStics CLEAr Auto Zero CALibration ZERO TYPE Command Format CALibration ZERO TYPE INTernal EXTernal CALibration ZERO TYPE Instruction Select zero type of power meter Get zero type of power meter Parameter Type Enumeration Parameter Range INTernal EXTer...

Page 104: ...ange None Return None Default None Menu SENSOR Click to perform zeroing Example SENSe ZERO Frequency Type SENSe POWer SOURce Command Format SENSe POWer SOURce RF USER SENSe POWer SOURce Instruction Select the signal source for the measurement Get the signal source for the measurement Parameter Type Enumeration Parameter Range RF USER Return Enumeration Default RF Menu SENSOR Frequency Example SENS...

Page 105: ...ange 9 kHz Full frequency range Return Float unit Hz Default None Menu SENSOR Frequency Example SENSe FREQuency 1 MHz SENSe FREQuency Level Offset State SENSe POWer OFFSet STATe Command Format SENSe POWer OFFSet STATe ON OFF 1 0 SENSe POWer OFFSet STATe Instruction Switch the power offset switch status Get the power offset switch status Parameter Type Boolean Parameter Range ON OFF 1 0 Return Bool...

Page 106: ... Parameter Type Float unit dB Parameter Range Limit by power sensor Return Float unit dB Default 0 dB Menu SENSOR Level Offset Example SENSe OFFSet 10 SENSe OFFSet Average Type SENSe POWer FILTer TYPE Command Format SENSe POWer FILTer TYPE AUTO USER NSRatio SENSe POWer FILTer TYPE Instruction Select the averaging mode Get the averaging mode Parameter Type Enumeration Parameter Range AUTO USER NSRa...

Page 107: ...NSOR Averaging Example SENSe FILTer LENGth 10 SENSe FILTer LENGth Internal Noise SENSe POWer FILTer NSRatio Command Format SENSe POWer FILTer NSRatio noise SENSe POWer FILTer NSRatio Instruction The power sensor will control the internal noise that does not exceed the set value of the fixed noise parameter Parameter Type Float unit dB Parameter Range Limit by power sensor Return Float unit dB Defa...

Page 108: ...Command Format SENSe POWer LOGGing STATe state SENSe POWer LOGGing STATe Instruction Set logging state Get logging state Parameter Type Boolean Parameter Range ON OFF 1 0 Return Boolean Default 0 Menu SENSOR Logging Example SENSe LOGGing STATe ON SENSe LOGGing STATe ...

Page 109: ...and perform write and read operations 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 ...

Page 110: ... 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 Include visa h file In the projectname cpp file include visa h ...

Page 111: ...vices 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 ViSession defaultRM ViSession instr ViUInt32 numInstrs ViFindList findList ViStatus status char instrResour...

Page 112: ...ter to continue fflush stdin getchar viClose defaultRM returnstatus 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 openi...

Page 113: ...w 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 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 A...

Page 114: ... 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 The run result ...

Page 115: ...anager status viOpenDefaultRM defaultRM if status VI_SUCCESS 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 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 i...

Page 116: ...ESS printf viRead failed with error code x n status viClose defaultRM else printf nMesseage read from device s n 0 outputBuffer status viClose instr status viClose defaultRM printf Press Enter to exit fflush stdin getchar return 0 int _tmain int argc _TCHAR argv printf Please input IP address char ip 256 fflush stdin gets ip TCP_IP_Test ip ...

Page 117: ...evice with USBTMC and TCP IP access and perform write and read operations 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 f...

Page 118: ...MC 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 def...

Page 119: ... of resources in the system in numInstrs status viFindRsrc defaultRM USB INSTR findList numlnstrs instrResourceString If status VI_SUCCESS Then resultTxt Text 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 indi...

Page 120: ...Str 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 resultTxt Text Error writing to the device status viClose instrsesn GoTo NextFind End If Now we will attempt to read back a resp...

Page 121: ...rces status viClose defaultRM Usbtmc_test 0 End Function 2 TCP IP access code Write a function TCP_IP_Test Private Function TCP_IP_Test ByVal 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...

Page 122: ...ultRM TCP_IP_Test status Exit Function End If status viWrite instrsesn IDN 5 count If status VI_SUCCESS Then resultTxt Text Error writing to the device End If status viRead instrsesn outputBuffer VI_FIND_BUFLEN count If status VI_SUCCESS Then resultTxt Text Error reading a response from the device CStr i 1 Else resultTxt Text read from device outputBuffer End If status viClose instrsesn status viC...

Page 123: ...Private Sub tcpipBtn_Click Dim stat As Long stat TCP_IP_Test ipTxt Text If stat VI_SUCCESS Then resultTxt Text Hex stat End If End Sub Private Sub usbBtn_Click Dim stat As Long stat Usbtmc_test If stat VI_SUCCESS Then resultTxt Text Hex stat End If End Sub The run result ...

Page 124: ...122 SSG5000A Programming Guide ...

Page 125: ...rent 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 conne...

Page 126: ...IDN Request the data outputbuffer fscanf vu disp outputbuffer Close the VISA object fclose vu delete vu clear vu end The run result 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 ...

Page 127: ...ed with IP address vt visa ni TCPIP0 10 11 13 212 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 The run result ...

Page 128: ...e 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 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 i...

Page 129: ...nufacturer 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 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 synchr...

Page 130: ...rtable Python has a low level networking module that provides access to the socket interface Python scripts can be written for sockets to do a variety of test and measurements tasks Environment Win10 64bit system Python v3 6 5 The functions of this example Opens a socket sends a query and closes the socket It does this loop 10 times Below is the code of the script usr bin env python coding utf 8 ...

Page 131: ...strument s IP address port 5025 the port number of the instrument service def SocketConnect try create an AF_INET STREAM socket TCP s socket socket socket AF_INET socket SOCK_STREAM except socket error input Failed to create socket nPress Enter to exit sys exit try Connect to remote server s connect remote_ip port except socket error input Failed to connect to ip s nPress Enter to exit remote_ip s...

Page 132: ...ose Sock sys exit reply Sock recv 4096 reply reply decode return reply def SocketClose Sock close the socket Sock close time sleep 300 def main Body send the SCPI commands IDN 10 times and print the return message s SocketConnect count 0 for i in range 10 qStr SocketQuery s b IDN n print str count qStr count count 1 SocketClose s input Press Enter to exit ...

Page 133: ...vides the ability to send single SCPI commands from a remote PC to the signal generator using LAN port number 5024 How to send single SCPI commands using Telnet 1 On the remote PC click Start then Run cmd 2 Type telnet ip address 5024 3 A Telnet window with a prompt should appear on the remote PC screen ...

Page 134: ...Programming Guide 4 From the SCPI prompt Type single SCPI commands Press Enter to send the command To exit the telnet window click X in the upper right corner To get a normal telnet prompt press Ctrl closing bracket ...

Page 135: ...SSG5000A Programming Guide 133 To get SCPI prompt again type open ip Address 5024 and press Enter To close the normal telnet window type Quit and press Enter ...

Page 136: ......

Page 137: ...s launched in 2005 SIGLENT has become the fastest growing manufacturer of digital oscilloscopes We firmly believe that today SIGLENT is the best value in electronic test measurement Headquarters SIGLENT Technologies Co Ltd Add Bldg No 4 No 5 Antongda Industrial Zone 3rd Liuxian Road Bao an District Shenzhen 518101 China Tel 86 755 3688 7876 Fax 86 755 3359 1582 Email sales siglent com Website int ...

Reviews: