Using NI-VISA - Visual Basic

NI-VISA Measurement & Automation

Using NI-VISA (in Visual Basic)

You must include the VISA32.BAS module in your Microsoft Visual Basic (version 4.0 or higher) application project file. This module is in the vxipnp\win95\include or vxipnp\winNT\include directory and contains the NI-VISA function prototypes for interfacing with the dynamic link library VISA32.DLL and VISA-specific constant definitions.

The VXI Visual Basic examples using VISA are in the ni-vxi\win32\vb\examples directory. You can use them as a reference to get started with your program.

The first function you should call is viOpenDefaultRM(). This initializes NI-VISA and gives you a handle to the VISA Resource Manager that you need in later function calls. After opening a session to the VISA Resource Manager, you can call viFindRsrc() to find out what instruments are available to open a session to. To access an instrument, open a session to it using viOpen(). Once the sessions to the instruments are open, you can set up any asynchronous event handlers that your program may need, and then perform your accesses to all your instruments. When you are done, call viClose() on each instrument handle and on the Resource Manager handle.

If you are writing an instrument driver, you should also include the module VPPTYPE.BAS in your application project file. This file is the VXIplug&play instrument driver header file and is in the vxipnp\win95\include or vxipnp\winNT\include directory.