Programming Manual MSO/UPO2000 Series
141 / 156
Instruments.uni-trend.com
Add file visa.h in projectname.cpp file
#include <visa.h>
1.
Source code:
a)
USBTMC Example
int usbtmc_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.
* 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 instrResourceString[VI_FIND_BUFLEN];
unsigned char buffer[100];
int i;
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)