Programming Guide
SIGLENT
SDL1000X Programming Guide 69
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');