National Instruments 370551A-01 用户手册

下载
页码 139
Chapter 7
Using the NI-VXI/NI-VISA Software
7-4
ni.com
System Configuration Functions
The System Configuration functions provide the lowest-level initialization 
of your VXI controller. For NI-VXI, use the 
InitVXIlibrary()
 function 
at the start of each application and the 
CloseVXIlibrary()
 function at 
the end of each application. For NI-VISA, use 
viOpenDefaultRM()
 
at the start of each application and the 
viClose()
 function at the end of 
each application.
Compiling Your C Program for NI-VXI/NI-VISA
You can use the sample programs included with the NI-VXI software as a 
starting point to develop your own C program that uses NI-VXI functions. 
First, look over and compile the sample programs using the makefile 
provided to get familiar with how the functions operate. The example 
programs are broken into multiple files, and each one shows how to use 
different groups of functions. You can then modify the sample programs to 
try out different aspects of the NI-VXI software.
The sample programs for the Linux C compiler are in the 
/usr/local/nivxi/examples
 directory for NI-VXI and 
/usr/local/vxipnp/linux/NIvisa/Examples
 directory for 
NI-VISA.
The easiest way to compile the sample programs is to use the makefile 
included with the NI-VXI/NI-VISA software. For example, go to the 
examples
 directory and type 
make
.
Symbols
You may need to define a symbol so that the NI-VXI library can work 
properly with your program. The 
VXILINUX
 symbol is required for NI-VXI 
applications, but not NI-VISA applications. 
VXILINUX
 designates the 
application as a Linux NI-VXI application. You can define this symbol 
using a 
#define
 statements in the source code or you can use 
the
-D
option in your compiler. If you use a 
#define
 statement, you must 
define the symbol before including the NI-VXI header file 
nivxi.h
. If you 
use the makefiles to compile the sample program, the makefile already 
defined the necessary symbol.