Programming Manual MSO/UPO2000 Series
139 / 156
Instruments.uni-trend.com
Programming Preparation
Programming preparation is only applicable for using Visual Studio and LabVIEW development tools to
programming under Windows operating system.
Firstly, user need to confirm that whether NI –VISA libray is installed (it can be download from the
website
https://www.ni.com/en-ca/support/downloads/drivers/download.ni-visa.html).
In this manual, the default installment path is C:\Program Files\IVI Foundation\VISA.
Build communication with PC via USB or LAN interface of the instrument, use USB data line to connect
USB DEVICE port on the rear panel of the instrument with USB port of PC, or use LAN data line to
connect LAN port on the rear panel of the instrument with LAN port of PC.
VISA Programming Example
There are some example in this section. Throught these examples, user can know how to use VISA, and
it can combined 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
Decription: 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 leftside, 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.