Programming Manual UTG1000X Series
Instruments.uni-trend.com
33
/
51
VISA Programming Example
There are some examples in this section. Through these examples, user can know how to use VISA,
and it can combine with the command of programming manual to realize the control of the
instrument. With these examples, user can develop more applications.
VC++
Example
Environment: Window system, Visual Studio
Description: Access the instrument via USBTMC and TCP/IP, and send "*IDN?" command on
NI-VISA to query the device information.
Steps
1.
Open Visual Studio software to create a new VC++ win32 console project.
2.
Set project environment that can adjust NI-VISA libray, which are static library and dynamic
library.
a)
Static library
:
In NI-VISA installment path to find file visa.h, visatype.h and visa32.lib and copy them to the root
path of VC++ project and add it to the project. Add two lines of code into file projectname.cpp as
follows.
#include "visa.h"
#pragma comment(lib,"visa32.lib")
b)
Dynamic library:
Press "project>>properties", select "c/c++---General" in attribute dialog on the left side, set the
value of "Additional Include Directories" as the installment path of NI-VIS (such as
C:\ProgramFiles\IVI Foundation\VISA\WinNT\include), as shown in the following figure.
Select "Linker-General" in attribute dialog on the left side, set the value of "Additional Library
Directories" as the installment path of NI-VIS (such as C:\Program Files\IVI