LabVIEW versions 6.0.x and later are able to
use IVI-COM drivers. In LabVIEW 6.0.x it is necessary to insert an extra line
into the LabVIEW.ini file in order to use the driver. This line is:
|
enableCustomInterface=True |
LabVIEW 6.1 does not require this INI file
change. The screen shot below shows a LabVIEW block diagram of a client that
returns the Number of Averages property from the Acquisition
interface. It uses the Session Factory to create the driver object so the code
is interchangeable.

From left to
right the code carries out the following tasks:
- Creates
an instance of the Session Factory object using the LabVIEW Automation Open
primitive.
- Runs
the Session Factory’s Create Driver method using a LabVIEW Invoke
Node. A driver’s logical name (“VektrexScope”) is passed to this method,
which is used to find the driver object to create by looking it up in the
Configuration Server’s XML file. A pointer to the created driver is
returned.
- Queries
the newly created driver for its IviScope interface. LabVIEW achieves
this using the Variant to Data primitive.
- Runs
the driver’s Initialize method. The same logical name as before is
used to find the device’s resource descriptor (e.g., GPIB0::13::INSTR) in
the Configuration Server’s XML file
- Runs
the get Number of Averages property. This is a two-step process,
before the property executes; it is necessary to “step down” to the
Acquisition interface using an interface reference property.
- Runs
the driver’s Close method and closes all created references using the
Automation Close primitive. In this example, three references were created,
one to the Session Factory, one to the driver’s IviScope interface and one
to the driver’s Acquisition interface.