Specifications

11
Figure 5 . Microsoft Visual Studio, add reference window, VISA-COM library
Find and select the VISA-COM 3.0 Type Library from the list.
When you add this reference to your project, a VisaComLib reference will be
listed under the project “References” treenode, as shown in Figure 4. This refer-
ence is now available in your project.
4.2 Using VISA-COM library references in your program code
Now you’ve added the VISA-COM library reference to your project, you can
interact with the VISA library from any code block in your project. Select the
code file you want to interact with the instrument and add a “using” statement
to simplify the namespace associated with the library reference.
Using Ivi.Visa.Interop;
Next you will want to create an instance of the VISA Resource Manager (to
interface with the resources, like GPIB or USB or VXI or com ports) and create
an instance of the VISA message-based session appropriate for your instrument.
For Agilent Technologies instruments, which are all designed for IEEE 488.2
GPIB message-based communication, we recommend the FormattedIO488 class
for instrument communication.
ResourceManager rMgr = new ResourceManagerClass();
FormattedIO488 src = new FormattedIO488Class();
Now we have a reference to the VISA resource manager and a reference to a
message-based session we’re going to use to communicate with an instrument.
To open a message-based session with an instrument and set a reasonable
timeout value, we use the following code.
src.IO = (IMessage)rMgr.Open(srcAddress, AccessMode.NO_
LOCK, 2000, null);
src.IO.Timeout = 2000;