1. IVI Configuration Hierarchy
Figure 1. Measurement & Automation Explorer--IVI Configuration Hierarchy
The IVI component of MAX reveals a hierarchy that enables you to take full advantage of the features IVI offers. At the highest level, the logical name is a generic entry that points to a virtual instrument. The virtual instrument contains information on a particular instrument driver and device when it is not simulating. The virtual instrument also contains settings for inherent attributes such as state caching, range checking, and simulating. You can also set virtual channel names and the default setup.
Setting up an instrument driver requires class information. The five instrument classes (DC Power Supply, Multimeter, Function Generator, Oscilloscope, Switch) are loaded with default settings when class drivers are installed. Class drivers represent classes of instruments. Class drivers are similar to logical names, but instead of virtual instruments, they point to simulated virtual instruments. A simulated virtual instrument consists of a simulation driver (only needed when simulating through a class driver) and default setup.
Instead of using the Initialize With Options VI (LabVIEW) or InitWithOptions function (LabWindows/CVI), you can use MAX to configure a virtual instrument and store its settings. You can initialize an instrument with the Initialize VI (or Init function) by entering the GPIB address (GPIB::2::INSTR) in the resource name as you would with a traditional driver. However, this approach does not implement the MAX settings. To implement the MAX settings enter the name of the configured virtual instrument or logical name. Using logical names and virtual instruments creates interchangeability of instruments and allows for the setting of inherent attributes outside of the application code.
Figure 2. Example of Non-Configurable Use of Instrument Descriptor in LabVIEW
If you want to interchange instruments in the future, use a logical name. To swap instruments, change the virtual instrument the logical name is pointing to in MAX. If you modify the virtual instrument settings in MAX, your setting changes are implemented without recompiling the application code. Consider the following example. If you previously configured the niDMM virtual instrument for a National Instruments DMM, you can set and use the Initialize VI of the specific driver. Replace the resource name string with niDMM. Figure 3 illustrates this configuration. The specific driver then uses the configuration parameters associated with the niDMM virtual instrument when it executes your application.
Figure 3. Example of Configurable Instrument Descriptor by Using Virtual Instruments in LabVIEW
The settings you make through MAX could conflict with the settings you make with the Initialize With Options VI. Therefore, if you attempt to use both approaches, you will generate errors. Make sure the option string is empty when you use the MAX approach.
Figure 4. niDMM Instrument Driver in the MAX IVI Instrument Drivers View
The logical names are in the IVI Instrument View of MAX. Along with Logical Names, you also see subfolders for Devices, Instrument Drivers, and Virtual Instruments. You can use logical names at both the class and specific driver level. Logical names point to virtual instruments and, when using class drivers, allow for interchangeability. Virtual instruments consist of an instrument driver, property settings and, when you do not want to simulate, a device. Instrument drivers specify the instrument driver DLL. The device properties specify the resource name to access a physical device.
2. Creating Logical Names
Complete the following steps to use the wizard in MAX to create a logical name.
1. Right-click the Logical Names subdirectory and select Insert to launch the wizard. The wizard guides you through the steps that are necessary to set up the logical name. You generally use logical names at the class driver level for matters of interchangeability although you might also use them when initializing a specific driver.
2. Enter the logical name and a brief description. The logical name can be anything. You use the logical name in the Initialize function to access the settings in MAX.
Figure 5. New Logical Name Dialog Box
3. Click on Next.
4. In the New Logical Name Virtual Instrument dialog box, choose an existing virtual instrument or create a new virtual instrument.
Figure 6. New Logical Name Virtual Instrument Dialog Box
5. Click on Next.
6. In the New Logical Name Summary dialog box, the wizard shows a summary of the logical name to be created.
7. Click on Finish when you are done creating the logical name.
3. Creating Virtual Instruments
Complete the following steps to use the wizard in MAX to create a virtual instrument.
1. Right-click the Virtual Instrument subdirectory and select Insert to launch the wizard. The wizard guides you through the steps to set up the virtual instrument. Use virtual instruments primarily at the specific driver level. You can use virtual instruments at the class driver level but doing so removes the potential for interchangeability.
Figure 7. New Virtual Instrument Dialog Box
2. Enter the name and a brief description of the virtual instrument. Use the virtual instrument name in the Initialize function to access the settings in MAX or it will be used by a logical name.
3. Click on Next to display the New Virtual Instrument Driver dialog box.
4. In the New Virtual Instrument Driver dialog box, choose Use an Existing Specific Driver or Create a New Specific Driver.
Figure 8. New Virtual Instrument Driver Dialog Box
5. In the New Virtual Instrument Device dialog box, choose Use an Existing Device, Create a New Device, or None-Simulate the Device. If you choose None-Simulate the Device, the wizard sets the virtual instrument to simulation mode.
6. Click on Next to display the New Virtual Instrument Device dialog box.
Figure 9. New Virtual Instrument Device Dialog Box
7. In the fourth dialog box, the wizard shows a summary of the virtual instrument to be created. Click Finish when you are done creating the virtual instrument.
4. Creating Instrument Drivers
Complete the following steps to use the wizard in MAX to create an instrument driver.
1. Right-click the Instrument Driver subdirectory and select Insert to launch the wizard. The wizard guides you through the steps that are necessary to set up the instrument driver.
2. To create an instrument driver, enter the driver name, a brief description, the driver file (a .dll file that will reside in the \VXIPNP\WIN95\bin\directory), the function prefix of the instrument driver, and the associated class of the instrument driver in the New Driver dialog box, as shown in Figure 10.
Figure 10. Creating an Instrument Driver
3. Click on Finish to create the virtual instrument.
5. Creating Specific Devices
Complete the following steps to use the wizard in MAX to create a specific device.
1. Right-click the Devices subdirectory and select Insert to launch the wizard. The wizard guides you through the steps that are necessary to set up the specific device.
2. To create a specific device, enter the Device Name, Description, and Resource Descriptor. The Resource Descriptor consists of the interface type (GPIB, DAQ, and so on), followed by two colons, the number of the address, two colons, and finally INSTR. An example of a Resource Descriptor is GPIB::4::INSTR. The wizard is shown in Figure 11.
Figure 11. Creating a Device
3. Click on Finish to create the specific device.
Creating Class Drivers, Simulation Instruments, and Simulation Virtual Instruments When creating instrument drivers, the wizard requires you to specify the class of the instrument. When you load NI class drivers, these entries are entered into MAX for later use. However, you can create your own class drivers, simulation instruments, and simulation virtual instruments by right-clicking on the particular directory and selecting Insert. Follow the MAX wizard to complete the configuration.
6. Modifying Virtual Instrument Properties
Complete the following steps to modify the properties of a virtual instrument.
1. Right-click the VI and select Properties. As shown in Figure 12, the Properties window has four tabs: Virtual Instrument, Inherent Attributes, Channels, and Default Setup. Select the tab with the properties that you need to modify.
2. On the Virtual Instrument tab, you can modify the description and the properties of the specific driver and device. You can also change the specific driver or device used by this virtual instrument. To modify the properties of the specific driver, click Properties in the Specific Driver area which brings up the specific driver you want to modify.
3. To change the specific driver that the virtual instrument is using, click Change in the Specific Driver area.
4. To modify the device used by the virtual instrument, click Properties in the Device area.
5. To change to a different device, click Change in the Device area.
6. Click OK to save any modifications, or Cancel to undo any changes.
Figure 12. Instrument Driver and Device Properties of Virtual Instrument
7. On the Inherent Attributes tab, you can enable and disable the State Caching, Range Checking, Query Instrument Status, Record Coercion, Interchange Check, and Spy options. You can also enable, disable, and setup the Simulation mode. You can choose to simulate through the class driver or through the specific driver. If you choose to simulate through the class driver, then it chooses the same virtual instrument the class driver uses.
8. You can change the simulation virtual instrument's properties by clicking Properties or clicking Change to choose a new simulation virtual instrument. To learn more about inherent attributes see the DevZone document,Using Drivers in LabVIEW.
Caution: If you enable Record Value Coercion and never use Get Next Coercion Record VI to retrieve and clear those coercion records, the records build up and could eventually overflow your computer memory.
9. If you want to use the virtual instrument, but have modified it to not use a device, set the virtual instrument to Simulation mode under the Inherent Attributes tab.
Figure 13. Inherent Attributes of Virtual Instruments
10. On the Channel tab, you can setup virtual channel names to be associated with the instrument's specific channel strings. In your application code, use the virtual channel name for matters of interchangeability.
Figure 14. Virtual Channel Name Setup
11. The Default Setup tab contains the configuration of the default values of an instrument's attributes. This does not usually need to be used, but in a few instances is needed to achieve interchangeability when physically swapping instruments.
Figure 15. Virtual Instrument Default Setup
IVI opens many possibilities for instrument driver users. Logical names and virtual instruments make IVI drivers interchangeable and intelligent. MAX helps you to easily and conveniently configure logical names and virtual instruments while maximizing the capabilities of IVI drivers.