Provide examples with source code. Call user-accessible VIs to teach users how to control the instrument. Examples help users understand the recommended calling sequence necessary to perform instrument operations. If a simple example calls an excessive number of API VIs, the instrument driver might need a more appropriate level of granularity. The figures below show the front panel and block diagram of an instrument driver example VI.
Examples are self-contained and runnable VIs that perform complete operations. For example, a good example VI for a DMM configures, starts, and reads from the DMM. Include calls to the Initialize, Close and Simple Error Handler in your examples. Also, example VIs help users establish communication with the instrument and learn how to programmatically control the instrument.
Example VIs are not part of the instrument driver API and, therefore, users should not use them as subVIs. Examples might change from one driver release to the next. If you wire the terminals to the connector pane, end users might use the example VI in their applications. A change to the example in a future release would break their application.
Users expect most instrument drivers to include an example for each typical use case for an instrument. Including multiple examples benefits a wider range of customers.
Use names in the example VIs that describe the operation the VI performs, such as "Agilent 33XXX Series Generate Arbitrary Waveform" or "Tektronix PA1000 Acquire Harmonic Measurement".
To aid users in getting started with an example VI, include tip strips for the controls. Tip strips are brief descriptions that appear when users move cursors over a front panel object.
Often, users start with an example when they first start using an instrument driver. Include important information about using the driver and the example on the front panel and in the Context Help of the example VI. Include information on supported instrument model(s), required bus configuration settings, and required instrument cabling and hardware setup. Include a sentence on the front panel that instructs users to refer to the Context Help for more information on using the instrument driver.
The figure below shows how the Examples Folder (.lvproj) and other folders are organized in the Project Explorer
Select Tools»Prepare Example VIs for NI Example Finder to prepare example VIs you create to appear in the NI Example Finder. Select Hardware Input and Output»Instrument Drivers»LabVIEW Plug and Play for the browse path. Select keywords to be associated with the driver. Keywords should include the following: the words "instrument" and "driver" the manufacturer's name, such as "Agilent" or "Mettler" and "Toledo" the supported instrument model and/or series name some type of product reference, such as "DMM," "analyzer," or "scope"Use the Build Data File tab to build the data (.bin3) file that stores the task-based browse paths, keywords, and other information about the example VIs you document. Include this newly created data (.bin3) file with your driver. Refer to the LabVIEW Help for more information about running this tool.