DSO programming guide - Page 237

For SDS2352X-E.

Loading ...
Loading ...
Loading ...
Digital Oscilloscope Series
237
MATLAB Example
Environment: Windows7 32-bit, MATLAB R2010b
Description: 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.
Steps:
1. Open MATLAB, and 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. Coding:
a) USBTMC:
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?');
%Request the data
outputbuffer = fscanf(vu);
disp(outputbuffer);
%Close the VISA object
fclose(vu);
delete(vu);
clear vu;
end
b) TCP/IP:
Loading ...
Loading ...
Loading ...