EXAMPLE The following instruction sets the X mask to 0.4div and the Y mask to 0.
Digital Oscilloscopes Series SAVE/RECALL PF_SAVELOAD,PFSL Command DESCRIPTION The PF_SAVELOAD command saves or recalls the created mask setting. COMMAND SYNTAX PF_SAVELOAD LOCATION,,ACTION, The means to save the created mask setting to the internal memories or the external memories. : = {IN,EX} IN means to save the mask setting to the internal memories while EX means the external memories.
Digital Oscilloscopes Series FUNCTION PF_CONTROL,PFCT Command/Query DESCRIPTION The PF_CONTROL command controls the pass/fail controlling options: ―operate‖, ―output‖ and the ―stop on output‖. See instrument‘s Operator Manual for these options The response to the PF_ CONTROL? query indicates the controlling options of the pass/fail.
Digital Oscilloscopes Series FUNCTION PF_CREATEM,PFCM Command DESCRIPTION The PF_CREATEM command creates the mask of the pass/fail. COMMAND SYNTAX PF_ CREATEM EXAMPLE The following instruction creates the mask of the pass/fail.
Digital Oscilloscopes Series FUNCTION PF_DATADIS, PFDD Query DESCRIPTION The PF_DATADIS? query returns the number of the fail ,pass and total number that the screen showing.
Digital Oscilloscopes Series SAVE/RECALL SETUP *RCL Command DESCRIPTION The *RCL command sets the state of the instrument, using one of the ten non-volatile panel setups, by recalling the complete frontpanel setup of the instrument. Panel setup 0 corresponds to the default panel setup. The *RCL command produces the opposite effect of the *SAV command.
Digital Oscilloscopes Series WAVEFORM TRANSFER RECALL, REC Command DESCRIPTION The RECALL command recalls a waveform file from the current directory on mass storage into any or all of the internal memories M1 to M10(or M20 in the CFL series). COMMAND SYNTAX : RECall DISK, , FILE, ‗‘ : = {M1~M10}(or M1~M20 in the CFL series) : = {UDSK} := A waveform file under a legal DOS path . A filename-string of up to eight characters, with the extension “ .
Digital Oscilloscopes Series SAVE/RECALL SETUP RECALL_PANEL, RCPN Command DESCRIPTION The RECALL_PANEL command recalls a front-panel setup from the current directory on mass storage. COMMAND SYNTAX ReCall_PaNel DISK, , FILE, ‗‘ : = {UDSK} := A waveform file under a legal DOS path . A filename-string of up to eight characters, with the extension “.SET”. (This can include the ‗/‘ character to define the root directory.
Digital Oscilloscopes Series SAVE/RECALL SETUP *RST Command DESCRIPTION The *RST command initiates a device reset. The *RST sets recalls the default setup.
Digital Oscilloscopes Series FUNCTION REF_SET, REFS Command /Query DESCRIPTION The REF_SET command sets the reference waveform and its options. The response to the REF_ SET? query indicates whether the specified reference waveform is turned on.
Digital Oscilloscopes Series SAVE/RECALL SETUP *SAV Command DESCRIPTION The *SAV command stores the current state of the instrument in internal memory. The *SAV command stores the complete front-panel setup of the instrument at the time the command is issued.
Digital Oscilloscopes Series HARD COPY SCREEN_DUMP,SCDP Command DESCRIPTION The SCREEN_DUMP command is used to obtain the screen information of image format .
Digital Oscilloscopes Series DISPLAY SCREEN_SAVE,SCSV Command/Query DESCRIPTION The SCREEN_SAVE command controls the automatic Screen Saver, which automatically shuts down the internal color monitor after a preset time. The response to the SCREEN_SAVE? query indicates whether the automatic screen saver feature is on or off. Note: 1. When the screen save is in effect, the oscilloscope is still fully functional.
Digital Oscilloscopes Series STATUS *SRE Command/Query DESCRIPTION The *SRE command sets the Service Request Enable register (SRE). This command allows the user to specify which summary message bit(s) in the STB register will generate a service request. A summary message bit is enabled by writing a ‗1‘ into the corresponding bit location. Conversely, writing a ‗0‘ into a given bit location prevents the associated event from generating a service request (SRQ).
Digital Oscilloscopes Series STATUS *STB? Query DESCRIPTION The *STB? query reads the contents of the 488.1 defined status register (STB), and the Master Summary Status (MSS). The response represents the values of bits 0 to 5 and 7 of the Status Byte register and the MSS summary message. The response to a *STB? Query is identical to the response of a serial poll except that the MSS summary message appears in bit 6 in place of the RQS message.
Digital Oscilloscopes Series ADDITIONAL INFORMATION Status Byte Register (STB) Bit Bit Value Bit Name Description 7 6 128 64 5 4 3 2 1 0 32 16 8 4 2 1 DIO7 MSS/RQS MSS=1 RQS=1 ESB MAV DIO3 VAB DIO1 INB 0 reserved for future use at least 1 bit in STB masked by SRE is 1 service is requested 1 an ESR enabled event has occurred 1 output queue is not empty 0 reserved 1 a command data value has been adapted 0 reserved 1 an enabled INternal state change has occurred Not (1) (2) (3) (4) (5) (6) Notes (1
Digital Oscilloscopes Series ACQUISTION STOP Command DESCRIPTION The STOP command immediately stops the acquisition of a signal. If the trigger mode is AUTO or NORM.
Digital Oscilloscopes Series WAVEFORM TRANSFER STORE, STO Command DESCRIPTION The STORE command stores the contents of the specified trace into the current directory in a USB memory device. COMMAND SYNTAX STOre : = {TA, TB, TC, TD, C1, C2, C3, C4,ALL_DISPLAYED} : = { UDSK} Note: 1. If the STORE command is sent without any argument, and the current trace isn‘t enabled, the current trace will be enabled and stored in the Store Setup.
Digital Oscilloscopes Series STO C1, M1 RELATED COMMANDS STORE_SETUP, RECALL 113
Digital Oscilloscopes Series SAVE/RECALL SETUP STORE_PAMEL,STPN Command DESCRIPTION The STORE_PANEL command stores the complete front-panel setup of the instrument, at the time the command is issued, into a file on the specified-DOS path directory in a USB memory device. COMMAND SYNTAX STore_PaNel DISK, , FILE, ‗‘ :={UDSK} < directory >:=A legal DOS path or filename. A filename -string of up to 8 characters, with the extension “.SET”.
Digital Oscilloscopes Series WAVEFORM TRANSFER STORE_SETUP,STST Command/Query DESCRIPTION The STORE_SETUP command controls the way in which traces will be stored. A single trace or all displayed traces may be enabled for storage. COMMAND SYNTAX STore_SeTup [, ] := {C1,C2,C3,C4,ALL_DISPLAYED } : ={UDSK} Note: The parameter is vary with oscilloscope‘s models. If your oscilloscope is not an SPO model, it‘s options are {M1~M10(or M20 in the CFL series)}, UDSK}.
Digital Oscilloscopes Series ACQUISITION SAMPLE_STATUS,SAST Query DESCRIPTION The SAST? query the acquisition status of the scope. QUERY SYNTAX SAST? RESPONSE FORMAT SAST < status > EXAMPLE The following command reads the acquisition status of the scope.
Digital Oscilloscopes Series ACQUISITION SAMPLE_RATE,SARA Query DESCRIPTION The SARA? query returns the sample rate of the scope. QUERY SYNTAX SARA? RESPONSE FORMAT SARA< value > EXAMPLE The following command reads the sample rate of the scope. Command message: SARA? Response message: SARA 500.
Digital Oscilloscopes Series ACQUISITION SAMPLE_RATE,SANU Query DESCRIPTION The SANU? query returns the number of sampled points available from last acquisition and the trigger position. QUERY SYNTAX SANU? RESPONSE FORMAT SANU EXAMPLE The following command reads the number of sampled points available from last acquisition from the Channel 2.
Digital Oscilloscopes Series FUNCTION SET50,SET50 Command DESCRIPTION The SET50 command sets the trigger level of the specified trigger source to the centre of the signal amplitude. COMMAND SYNTAX SET50 EXAMPLE The following command sets the trigger level of the specified trigger source to the centre of the signal amplitude Command message: SET50 Note: This command is suitable for non-SPO models.
Digital Oscilloscopes Series ACQUISITION SKEW,SKEW Command DESCRIPTION The SKEW command sets the skew value of the specified trace. The response to the SKEW? query indicates the skew value of the specified trace. COMMAND SYNTAX :SKEW : = {C1,C2,C3,C4 } : = it is a value about time.
Digital Oscilloscopes Series ACQUISITION SINXX_SAMPLE, SXSA Command/Query DESCRIPTION The SINXX_SAMPLE command sets the way of interpolation. The response to the SINXX_SAMPLE? query indicates the way of interpolation.
Digital Oscilloscopes Series ACQUISITION TIME_DIV,TDIV Command/Query DESCRIPTION The TIME_DIV command modifies the timebase setting. The new timebase setting may be specified with suffixes: NS for nanoseconds, US for microseconds, MS for milliseconds, S for seconds, or KS for kiloseconds. An out-of-range value causes the VAB bit (bit 2) in the STB register to be set. The TIME_DIV? query returns the current timebase setting.
Digital Oscilloscopes Series WAVEFORM TRANSFER TEMPLATE, TMPL Query DESCRIPTION The TEMPLATE? query produces a copy of the template that describes the various logical entities making up a complete waveform. In particular, the template describes in full detail the variables contained in the descriptor part of a waveform. QUERY SYNTAX TeMPLate? RESPONSE FORMAT TeMPLate ―‖ : = A variable length string detailing the structure of a waveform.
Digital Oscilloscopes Series DISPLAY TRACE,TRA Command/Query DESCRIPTION The TRACE command enables or disables the display of a trace. An environment error is set if an attempt is made to display more than four waveforms. The TRACE? query indicates whether the specified trace is displayed or not.
Digital Oscilloscopes Series ACQUISITION *TRG Command DESCRIPTION The *TRG command executes an ARM command.
Digital Oscilloscopes Series ACQUISITION TRIG_COUPLING, TRCP Command /Query DESCRIPTION The TRIG_COUPLING command sets the coupling mode of the specified trigger source. The TRIG_COUPLING? query returns the trigger coupling of the selected source.
Digital Oscilloscopes Series ACQUISITION TRIG_DELAY, TRDL Command /Query DESCRIPTION The TRIG_DELAY command sets the time at which the trigger is to occur with respect to the first acquired data point. This mode is called pre-trigger acquisition, as data are acquired before the trigger occurs. Negative trigger delays must be given in seconds. This mode is called post-trigger acquisition, as the data are acquired after the trigger has occurred.
Digital Oscilloscopes Series ACQUISITION TRIG_LEVEL, TRLV Command /Query DESCRIPTION The TRIG_LEVEL command adjusts the trigger level of the specified trigger source. An out-ofrange value will be adjusted to the closest legal value and will cause the VAB bit (bit 2) in the STB register to be set. The TRIG_LEVEL? query returns the current trigger level. COMMAND SYNTAX : TRig_LeVel : = {C1, C2, C3, C4, EX, EX5} : = -4.5DIV* volt/div to 4.
Digital Oscilloscopes Series ACQUISITION TRIG_LEVEL2, TRLV2 Command /Query DESCRIPTION The TRIG_LEVEL2 command adjusts the second trigger level of the specified trigger source. An out-of-range value will be adjusted to the closest legal value and will cause the VAB bit (bit 2) in the STB register to be set. The TRIG_LEVEL? query returns the current trigger level. COMMAND SYNTAX : TRig_LeVel2 : = {C1, C2, C3, C4, EX, EX5} : = -4.5DIV* volt/div to 4.
Digital Oscilloscopes Series ACQUISITION TRIG_MODE, TRMD Command /Query DESCRIPTION The TRIG_MODE command specifies the trigger mode. The TRIG_MODE? query returns the current trigger mode. Note: STOP is a part of the option of this command, but is not a trigger mode of the instrument. COMMAND SYNTAX TRig_MoDe : = {AUTO, NORM, SINGLE,STOP} Note: The suffix V is optional and assumed.
Digital Oscilloscopes Series ACQUISITION TRIG_SELECT, TRSE Command /Query The TRIG_SELECT command selects the condition that will trigger the acquisition of waveforms. Depending on the trigger type, additional parameters must be specified. These additional parameters are grouped in pairs. The first in the pair names the variable to be modified, while the second gives the new value to be assigned. Pairs may be given in any order and restricted to those variables to be changed.
Digital Oscilloscopes Series QUERY SYNTAX TRig_SElect? RESPONSE FORMAT TRig_Select , SR,
Digital Oscilloscopes Series : = {PO,NE} PO means positive. NE means negative. CHAR, : is used to set the standard. If you want to set it, the must be set to TV. :={NTSC, PALSEC} SYNC,: is used to set sync. If you want to set it. You must set to TV : = {AL,LN,OF,EF} AL means all lines; LN means line num; OF means odd field; EF means even field. LINE,: is used to set the line num. if you want to set it.
Digital Oscilloscopes Series ACQUISITION TRIG_SLOPE, TRSL Command /Query DESCRIPTION The TRIG_SLOPE command sets the trigger slope of the specified trigger source. The TRIG_SLOPE? query returns the trigger slope of the selected source.
Digital Oscilloscopes Series ACQUISITION TRIG_WINDOW, TRWI Command /Query DESCRIPTION The TRIG_WINDOW command sets the relative height of the two trigger line of the trigger window type. The TRIG_WINDOW? query returns relative height of the two trigger line of the trigger window type. COMMAND SYNTAX TRig_WIndow < value >: -4.5DIV* volt/div to 4.
Digital Oscilloscopes Series ACQUISITION TRIG_PATTERN, TRPA Command /Query DESCRIPTION The TRIG_PATTERN command condition of the pattern trigger. sets the The TRIG_ PATTERN? query returns the condition of the pattern trigger.
Digital Oscilloscopes Series ACQUISITION UNIT, UNIT Command /Query DESCRIPTION The UNIT command sets the unit of the specified trace. The UNIT query returns the unit of the specified trace.
Digital Oscilloscopes Series DISPLAY VERT_POSITION,VPOS Command /Query DESCRIPTION The VERT_POSITION command adjusts the vertical position of the specified FFT trace on the screen. It does not affect the original offset value obtained at acquisition time. The VERT_POSITION? query returns the current vertical position of the specified FFT trace. COMMAND SYNTAX : Vert_POSITION : = {TA, TB, TC, TD} :=-40 DIV to 40 DIV Note: The suffix DIV is optional.
Digital Oscilloscopes Series ACQUISITION VOLT_DIV, VDIV Command /Query DESCRIPTION The VOLT_DIV command sets the vertical sensitivity in Volts/div. The VAB bit (bit 2) in the STB register is set if an out-of-range value is entered. The VOLT_DIV query returns the vertical sensitivity of the specified channel. COMMAND SYNTAX : Volt_DIV := {C1, C2, C3, C4} := 2mV to 10V Note: The suffix V is optional.
Digital Oscilloscopes Series ACQUISITION VERTICAL, VTCL Command /Query DESCRIPTION The VERTICAL command controls the vertical position of the slope trigger line. It is related to the TRSE command. The VERT option of the TRSE command changes the controlling type of the slopes trigger line. When the slope trigger lines are both controlled, the vertical position of the slope trigger line is the up one‘s position. The VERTICAL query returns the vertical position of the slope trigger line.
Digital Oscilloscopes Series WAVEFORM TRANSFER WAVEFORM,WF Query DESCRIPTION A WAVEFORM? Query transfers a waveform from the oscilloscope to the controller. Note: 1. The format of the waveform data depends on the current settings specified by the last WAVEFORM_SETUP command. 2.The format of the waveform data can be seen by the TEMPLATE? Query. QUERY SYNTAX : WaveForm? [] : = { C1,C2,C3,C4} : = {DESC, DAT2,ALL} DESC: Return descriptor.
Digital Oscilloscopes Series Response message: As follow picture: The head of message: C1:WF ALL. These are followed by the string #900000070, the beginning of a binary block in which nine ASCII integers are used to give the length of the block (70 bytes).After the length of block, is beginning of wave data. At the last meet ―0A 0A‖, means the end of data. How to use the data recovery waveform: 1. To calculate the voltage value corresponding to the data point.
Digital Oscilloscopes Series trdl: The time value which is center of the screen. timebase: The timebase value. grid: The grid numbers in horizontal direction. The following picture as an example: Send command ―TRDL?‖,return‖ TRDL -5.000000ns‖. Get the current time value center of the screen: trdl = -5.00E-09s. Send command ―TDIV?‖,return‖ TDIV 5.00E-09S‖. Get the current timebase: timebase = 5.00E-09S. The time value of the first data point: time value = -5.00E-09 – (5.00E09*14/2) = -40.00E-09(s)=-40(ns).
Digital Oscilloscopes Series WAVEFORM TRANSFER WAVEFORM_SETUP, WFSU Command/Query DESCRIPTION The WAVEFORM_SETUP command specifies the amount of data in a waveform to be transmitted to the controller. The command controls the settings of the parameters listed below. Note: FP First point SP Sparsing NP The number of points Sparsing (SP): The sparsing parameter defines the interval between data points.
Digital Oscilloscopes Series Usage2: WaveForm_SetUp TYPE, : = {0, 1} Note: 1. For SPO models, you can use the usage2 to control the returned waveform data, 0 means all waveform data of screen, 1 means all waveform data of memory depth. QUERY SYNTAX WaveForm_SetUp? Note: 1. Parameters are grouped in pairs. The first of the pair names the variable to be modified, whilst the second gives the new value to be assigned.
Digital Oscilloscopes Series ACQUISITION WAIT,WAIT Command DESCRIPTION The WAIT command prevents the instrument from analyzing new commands until the oscilloscope has completed the current acquisition. The instrument will be waiting for trigger or the limit time over (if we set it) or the device time out when we sent this command COMMAND SYNTAX WAIT
Digital Oscilloscopes Series DISPLAY XY_DISPLAY, XYDS Command /Query DESCRIPTION The XY_DISPLAY command enables or disables the display the XY format The response to the XY_DISPLAY? query indicates whether the XY format display is enabled.
Digital Oscilloscopes Series Programming Examples This chapter give some examples for the programmer. In these examples you can see how to use the NI-VISA lib and the commands which have been described before this chapter to control our devices. By the examples‘ guide, you can develop more functions application as you want. This example is developed by Visual Studio project.
Digital Oscilloscopes Series 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 project. 2、Set the project environment to use the NI-VISA lib, there are two ways to use NI-VISA, static or automatic: 2.1 Static: find files: visa.h, visatype.h, visa32.lib in NI-VISA install path.
Digital Oscilloscopes Series 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 Include visa.h file: In the projectname.
Digital Oscilloscopes Series #include 3、Add codes: 3.1 USBTMC access code: Write a function Usbtmc_test. IntUsbtmc_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.
Digital Oscilloscopes Series ViSessioninstr; ViUInt32numInstrs; ViFindListfindList; ViUInt32retCount; ViUInt32writeCount; ViStatusstatus; CharinstrResourceString[VI_FIND_BUFLEN]; Unsigned char buffer[100]; Charstringinput[512]; Int i; /** First we must call viOpenDefaultRM to get the manager * handle. We will store this handle in defaultRM.
Digital Oscilloscopes Series status = viFindRsrc (defaultRM, "USB?*INSTR", &findList, &numInstrs, instrResourceString); if (status
Digital Oscilloscopes Series for (i=0; i 0) viFindNext (findList, instrResourceString); status = viOpen (defaultRM, instrResourceString, VI_NULL, VI_NULL, &instr); if (status
Digital Oscilloscopes Series 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
Digital Oscilloscopes Series { CharoutputBuffer[VI_FIND_BUFLEN]; ViSessiondefaultRM, instr; ViStatusstatus; ViUInt32count; ViUInt16portNo; /* First we will need to open the default resource manager.
Digital Oscilloscopes Series printf ("An error occurred opening the session\n"); viClose(defaultRM); } status = viPrintf(instr, "*idn?\n"); status = viScanf(instr, "%t", outputBuffer); if (status
Digital Oscilloscopes Series 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 Module. Search for the visa32.
Digital Oscilloscopes Series 3.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.
Digital Oscilloscopes Series 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 Debug.
Digital Oscilloscopes Series 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.
Digital Oscilloscopes Series status = viFindNext(findList, instrResourceString) End If status = viOpen(defaultRM, instrResourceString, VI_NULL, VI_NULL, 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.
Digital Oscilloscopes Series ' 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 ' viClose.
Digital Oscilloscopes Series 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.
Digital Oscilloscopes Series TCP_IP_Test = status Exit Function 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.
Digital Oscilloscopes Series 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: Open MATLAB, modify the current directory. In this demo, the current directory is modified to D:\USBTMC_TCPIP_Demo. Click File>>New>>Script in the Matlab interface to create an empty M file Add codes: USBTMC access code: Write a function Usbtmc_test.
Digital Oscilloscopes Series %Request the data outputbuffer = fscanf(vu); disp(outputbuffer); %Close the VISA object fclose(vu); delete(vu); clear vu; end 3.2 TCP/IP access code: Write a function TCP_IP_Test. function TCP_IP_test( IPstr ) % 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.
Digital Oscilloscopes Series disp(outputbuffer); %Close the VISA object fclose(vt); delete(vt); clear vt; end Example of LabVIEW Environment: Win7 32bit system, LabVIEW 2011 168
Digital Oscilloscopes Series 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 column. 3、Open the Block Diagram interface.
Digital Oscilloscopes Series 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 need to change VISA Write and VISA Read Function to Synchronous I/O.
Digital Oscilloscopes Series 8、Input the IP address and run the program.
Digital Oscilloscopes Series Example of C# 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 C# project. 2、Add References. Add NationalInstruments.Common.dll and NationalInstruments.VisaNS.dll to the project. (Notice: you must install the .NET Framework 3.5/4.0/4.5 Languages support when you install the NI-VISA.
Digital Oscilloscopes Series using NationalInstruments.VisaNS; namespace TestVisa { class Program { static void Main(string[] args) { // Find all the USBTMC resources string[] usbRsrcStrings = ResourceManager.GetLocalManager().FindResources("USB?*INSTR"); if (usbRsrcStrings.Length <= 0) { Console.WriteLine("Can not find USBTMC Device!"); return; } //Choose the first resource string to connect the device.
Digital Oscilloscopes Series Console.
Digital Oscilloscopes Series Index A ALL_STATUS?, ALST?, Query, ARM_ACQUISITION, ARM, Command, ATTENUATION, ATTN,Command/Query, AUTO_CALIBRATE, ACAL,Command/Query, AUTO_SETUP, ASET,Command, AUTO_TYPESET, AUTTS, Command/Query, AVERAGE_ACQUIRE, AVGA, Command/Query, B BANDWIDTH_LIMIT, BWL,Command/Query, BUZZER, BUZZ, Command, C CAL?, Query, CLS, Command, CMR?, Query, COMM_NET, CONET,Command/Query, COUPLING, CPL,Command/Query, CURSOR_SET, CRST,Command/Query, CURSOR_VALUE?, CRVA?,Query, CURSOR_AUTO, CRAU, Com
Digital Oscilloscopes Series F FILENAME, FLNM,Command/Query, FORMAT_VDISK, FVDISK, Query, FILTER, FILT, Command/Query, FILT_SET, FILTS, Command/Query, FFT_WINDOW, FFTW, Command/Query, FFT_ZOOM, FFTZ, Command/Query, FFT_SCALE, FFTS, Command/Query, FFT_FULLSCREEN, FFTF, Command/Query, G GRID_DISPLAY, GRDS, Command/Query, GCSV, GET_CSV, Query, H HARDCOPY_SETUP, HCSU, HOR_MAGNIFY, HMAG,Command/Query, HOR_POSITION, HPOS,Command/Query, I IDN?, Query, INTENSITY, INTS,Command/Query, INTERLEAVED, ILVD,Command/Qu
Digital Oscilloscopes Series PEAK_DETECT, PDET,Command/Query, PERSIST, PERS,Command/Query, PERSIST_SETUP, PESU,Command/Query, PANEL_SETUP,PNSU, Command/Query, PF_DISPLAY, PFDS, Command/Query, PF_SET, PFST, Command/Query, PF_SAVELOAD, PFSL, Command, PF_CONTROL, PFCT, Command/Query, PF_CREATEM, PFCM, Command, PF_DATEDIS, PFDD, Query, R RCL, Command, RECALL, REC, Command, RECALL_PANEL, RCPN,Command, RST, Command, REF_SET, REFS, Command/Query, S SAV, Command, SCREEN_DUMP, SCDP,Command/Query, SRE, Command/Quer
Digital Oscilloscopes Series U UNIT, UNIT, Command/Query, V VOLT_DIV, VDIV,Command/Query, VERTICAL, VTCL, Command/Query, W WAIT, Command, WAVEFORM,WF,Command/Query, WAVEFORM_SETUP,WFSU,Command/Query, X XY_DISPLAY, XYDS, Command/Query, 178