Programming Guide

Digital Oscilloscopes Series
166
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.
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::0xF4EC::0xEE38::0123456789::INSTR');
%Open the VISA object created
fopen(vu);
%Send the string "*IDN?",asking for the device's identification.
fprintf(vu,'*IDN?');