Instructions

T3VNA Programming Guide 69
4. Programming Examples
This chapter gives some examples for the programmer. In these examples you can see how
to use the VISA or sockets, in combination with the commands have been described above
to control the vector network analyzer. By following these examples, you can develop many
more applications.
4.1 Examples of Using VISA
4.1.1 Example of VC++
Environment:Win7 32bit system, Visual Studio
The functions 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 nish the example:
1Open Visual Studio, create a new VC++ win32 console project.
2Set the project environment to use the NI-VISA lib, there are two ways to use NI-VISA,
static or automatic:
1)Static: nd les: visa.h, visatype.h, visa32.lib in NI-VISA install path. Copy them to your
project, and add them into project. In the projectname.cpp file, add the follow two lines:
#include "visa.h"
#pragma comment(lib,"visa32.lib")
2)Automatic:
Set the .h file include directory, the NI-VISA install path, in our computer we set the path is:
C:\Program Files\IVI Foundation \VISA\WinNT\include. Set this path to project---properties---
c/c++---General---Additional Include Directories: See the picture.
Set lib path set lib file:
Set lib path: the NI-VISA install path, in our computer we set the path is: C:\Program Files\IVI
Foundation\VISA\WinNT
\lib\msc. Set this path to project---properties---Linker---General---Additional Library
Directories: as seen in the pictures below.