Getting Started with VISA COM I/O

Introduction

VISA COM I/O is based on the VISA I/O architecture. The fundamental unit in VISA is the Resource Session, an object that represents a discrete connection to a physical resource of some kind. Some resources support multiple simultaneous sessions, but one session talks to only one physical resource for the session's entire lifetime. In VISA COM, one COM object represents one VISA resource session.  The COM object is only considered a VISA resource during the portion of its lifetime between initialization (via the object's Init method or creation by a Resource Manager) and closing (either destruction of the object upon the reference count going to zero or a call to the Close method, whichever comes first).

Finding Resources and Creating Resource Session Objects

VISA has the concept of resource managers, which find resources and create VISA resource sessions. VISA has a function called GetDefaultRM that can create the default resource manager. VISA COM has a Global Resource Manager (GRM) that can find and use Vendor-Specific Resource Managers (SRMs) to find and create sessions to all the resources on a system. The GRM and the SRMs export the IResourceManager interface for this purpose. You will typically use the GRM, which can find resources supported by any VISA implementation installed on your PC.

The IResourceManager interface has two methods, one for finding resources and one for creating resource sessions, that you will find useful. FindRsrc takes a VISA search string and returns all the resources that match that string. Open takes a VISA address string and returns a pointer to the IVisaSession interface of a resource session object.  See Creating and Using the Resource Manager for examples of creating and using the GRM.

Communicating with Resources

If you are familiar with VISA, you should not have too much trouble adjusting to communication with VISA COM. The two primary ways to communicate with resources on INSTR sessions are to use the IFormattedIO488 interface for formatted I/O or to use the native formatted I/O facilities of your development environment to communicate directly with the IMessage interface of the session object.  

There is no canonical interface for using formatted I/O to communicate with instruments in VISA COM, but you may find the interface IFormattedIO488 on the Basic Formatted I/O component useful. See Using Formatted I/O for information on how to create and use the basic formatted I/O component, and see IFormattedIO488 Overview for tips on choosing the method of communication with your instrument and for descriptions of all the methods.

Hints and Tips

There are a few things to keep in mind as well as some common difficulties with using VISA COM.  See Hints and Tips for information on these issues.

See Also

Notes