Instrument Driver Modification Instructions
Follow these instructions after creating an instrument driver using the Create New Instrument Driver Project wizard. Refer to the National Instruments Web site for more information about developing LabVIEW plug and play instrument drivers.
For assistance or feedback during any phase of the development process, please contact instrument.drivers@ni.com.
- Remove unsupported VIs
- Modify common driver VIs
- Modify instrument-specific VIs
- Create new instrument-specific VIs
- Create example VIs
- Update the VI Tree VI
- Update palette files
- Update or create a Readme file
- Submit the completed driver to the Instrument Driver Network at ni.com/idnet.
Removing Unsupported VIs
- Remove any instrument driver VIs in the project that the instrument does not support, including any common VIs such as Self-Test or Reset. You must identify the individual capabilities of your instrument to determine which VIs it supports. For example, the Digital Multimeter template includes VIs for making multipoint measurements. If you write a driver for a Digital Multimeter that does not support multipoint measurements, delete these VIs from both the driver project and driver directory.
- For each VI you removed, remove subVI calls to that VI from other instrument driver VIs in the project.
- Save the project (.lvproj) and project library (.lvlib) after removing files.
Modifying Common Driver VIs
- If you created the driver from a template, each common driver VI includes modification instructions in yellow text boxes on the front panel and/or block diagram. The common driver VIs include: Initialize, Close, Self-Test, Reset, Error Query, Revision Query, and Default Instrument Setup. Read the VI documentation, follow the modification instructions in each VI, and then delete the instructions.
- Follow these additional instructions:
- Initialize VI—Switch to the front panel and enter the default address information in the VISA resource name control. Refer to the VISA resource name control context help for the syntax for the device. Right-click the control and select Data Operations»Make Current Value Default from the shortcut menu. Update the context help of this control to show only information about supported buses for the instrument.
Modify or remove serial controls in the Serial Configuration cluster to match the capabilities of the instrument.
For example, if an instrument can only have 7 data bits and 1 stop bit, remove the Data Bits and Stop Bits controls and set these parameters as constants on the block diagram. If an instrument only supports 2 baud rates, remove unsupported rates from the Baud Rate control. Set the controls in the Serial Configuration
cluster to the instrument defaults, right-click the controls, and select Operate»Make
Current Values Default from the shortcut menu.
You also can use the Serial Configuration cluster for other configuration settings such as a non-serial bus like
TCP/IP. If necessary, update the cluster name and context help to reflect the controls within the cluster.
- Close VI—If you need to configure the instrument to a certain state before it can be closed, add the necessary code to the block diagram before the VISA Close function.
- Self-Test VI—Set the timeout constant on the block diagram to a value large enough for the instrument to finish its self-test. The default is 20,000 milliseconds, or 20 seconds.
- Error Query VI—Designed to parse multiple SCPI errors. If the instrument implements error
checking differently, refer to other instrument drivers, such as the Fluke 45 Multimeter, for alternatives to implement this functionality. The Error Query VI is included as a subVI in all driver VIs except low-level API VIs. For SCPI compliant instruments, use :SYST:ERR? for the error query command. For non-SCPI compliant instruments, parse the error query response to see if an error occurred. Based on the response, set the Boolean
status element of the error cluster to the appropriate state. The Boolean should be False if there is no instrument error to report, and True otherwise.
- Revision Query VI—Modify the Scan From String function to parse out the firmware query for the instrument.
- Save the project (.lvproj) and project library (.lvlib) after modifying files.
Modifying Instrument-specific VIs
Complete the following steps for each remaining VI in the driver.
- Open the VI and edit the front panel by adding, modifying, or removing controls and indicators as needed to perform the operation defined by the VI.
- Update the default values of the controls to match the default values of the instrument. Set the value on each control and then right-click the control and select Data Operations»Make Current Value Default from the shortcut menu.
- Update the control and indicator labels and descriptions to reflect any changes.
- Edit the VI icon as needed.
- If you removed or added controls and indicators, edit the connector pane to match.
- Edit the block diagram by updating the command strings and parsed responses to match instrument functionality.
- Edit the VI documentation as needed. An example of documentation you could enter for the Initialize VI is: This instrument driver supports serial communication. If you encounter problems when using serial communication, try using baud rates less than 19,200 and hardware handshaking.
- If you created the driver from a template, each VI includes modification instructions in yellow text boxes on the front panel and/or block diagram. Read the VI documentation, follow the modification instructions in the VI, and then delete the instructions.
- Save and test the VI.
- Save the project (.lvproj) and project library (.lvlib) after modifying files.
Creating New Instrument-specific VIs
- Use the Instrument Driver VI Wizard to create additional VIs that the instrument supports. If you created a driver from a class template, such as the Digital Multimeter template, the instrument probably supports additional functionality not covered by the class template. You should create additional VIs for each supported feature, using the existing VIs and structure for guidance. For example, oscilloscopes often have many types of triggers but the Oscilloscope template only includes support for edge triggering. If the instrument supports additional types of triggers, add this functionality with additional instrument driver VIs.
- Use polymorphic VIs to group related instrument driver VIs. For example, multiple trigger configuration VIs can be presented with one polymorphic VI.
- Save the project (.lvproj) and project library (.lvlib) after modifying files.
Below are some specific modifications for drivers created from the class templates.
- Digital Multimeter—The low-level VIs on the Configure and Data palettes allow more control of the DMM. They are not intended for use with the Read (Single Points) and Read (Multiple Points) template VIs, because these VIs already include portions of this functionality. Refer to the Read Triggered Multiple VI for an example of using these low-level VIs.
- Oscilloscope—The private Default Instrument Setup.vi should set the oscilloscope in single acquisition mode. This command may be similar to :ACQ:STOPA SEQ;.
- Function Generator—If the instrument supports arbitrary waveforms, you must create separate VIs to implement arbitrary waveform support. Do not add arbitrary waveform support to the Configure Standard Waveform.vi.
If the instrument automatically disables one mode when enabling another mode, you can implicitly enable the status of the modulation and sweep VIs. To do this, remove the Enable <x> Mode control and delete the False case from the block diagram.
Creating Example VIs
- Create two or more example VIs that demonstrate how to use the instrument driver. Examples should help users understand the recommended calling sequence necessary to perform instrument operations. Include an example for each typical use case for the instrument to benefit a wide range of users.
- Include example VIs in the instrument driver project, but not in the project library.
- Select Tools»Prepare Example VIs for NI Example Finder to add an example data file (.bin3) to the examples directory in the instrument driver project.
|
Note LabVIEW reserves the following prefixes and you cannot use them when you name the .bin3 file: ms, test, lv, daq, cvi, tree, fr, de, ja, vi, im, dsc, rt, _, ko, zh, it, and es. |
Updating the VI Tree VI
- Open the VI Tree VI and update the block diagram to reflect changes to the instrument driver. The VI Tree is not a subVI in an application. It is intended as a quick overview of the hierarchy of the driver VIs.
- Remove any VIs that are not supported by the instrument, including any common VIs such as Self-Test or Reset.
- Add any public VIs that you added to the driver.
- Save and close the VI.
Updating Palette Files
- After all VIs are complete, update the function palette files (.mnu) to reflect changes to the instrument driver. All public instrument driver VIs should be accessible from the palette file. Do not include example VIs in the palette file.
- Remove links to any VIs you removed from the driver.
- Add palette files for subpalettes as needed to enhance the palette usability for new VIs. The palette file should match the layout of the VI Tree and the project folder hierarchy.
Updating or Creating the Readme file
- Open the Readme.html file in an html editor. The Readme file is an html file that includes a driver overview, requirements for use, supported features, revision history, and other information on using the driver. If you created the driver from a template, the driver includes a Readme.html file with fields that you need to modify denoted in red text. If you created the driver yourself, you need to create the Readme.html file.
- Update the appropriate fields in the Readme file with information specific to the instrument and instrument driver. If you created the driver from a template, update and replace all instances of red text in the file.
- Save the Readme file.
- Update the Readme file with revision history each time you modify the driver.
Submitting the Instrument Driver to the Instrument Driver Network
Whether you are an instrument manufacturer interested in making an instrument driver more accessible or you are an individual wanting to share your driver development efforts with others, consider submitting the driver to the Instrument Driver Network at ni.com/idnet.