The following illustration shows the organization of a standard instrument driver. Once you understand this model, you will find it applies to numerous instrument drivers.
The Getting Started VIs are simple application VIs you can use without modification. Run this VI to verify communication with your instrument. Typically you will only need to change the instrument address before running the VI from the front panel. However, there are a few that also require you to specify the VISA Resource name (for example, GPIB::2). Refer to Chapter 20, VISA in LabVIEW, of the LabVIEW Measurements Manual for more information about VISA Resource names. The Getting Started VI generally consists of three subVIs: the Initialize VI, an Application VI, and the Close VI.
The Application VIs are high-level examples of grouping together low-level component functions to execute a typical programmatic instrument operation. For example, the Application VIs might include VIs to control the most commonly used instrument configurations and measurements. These VIs serve as a code example to execute a common operation such as configuring the instrument, triggering, and taking a measurement.
Because the application VIs are standard VIs with icons and connector panes, you can call them from any high-level application when you want a single, measurement-oriented interface to the driver. For many users, the application VIs are the only instrument driver VIs needed for instrument control. The HP34401 Example VI, shown in the following illustration, demonstrates an application VI front panel and block diagram.
The initialize VI, the first instrument driver VI called, establishes communication with the instrument. Additionally, it can perform any necessary actions to place the instrument either in its default power on state or in some other specific state. Generally, the initialize VI only needs to be called once at the beginning of your application.
The configuration VIs are a collection of software routines that configure the instrument to perform the desired operation. There may be numerous configuration VIs, depending on the particular instrument. After these VIs are called, the instrument is ready to take measurements or stimulate a system.
The action/status category contains two types of VIs. Action VIs initiate or terminate test and measurement operations. These operations can include arming the trigger system or generating a stimulus. These VIs are different from the configuration VIs because they do not change the instrument settings, but only order the instrument to carry out an action based on its current configuration. The status VIs obtain the current status of the instrument or the status of pending operations.
The data VIs transfer data to or from the instrument. Examples include VIs for reading a measured value or waveform from a measurement instrument, VIs for downloading waveforms or digital patterns to a source instrument.
The utility VIs perform a variety of operations that are auxiliary to the most often used instrument driver VIs. These VIs include the majority of the instrument driver template VIs such as reset, self-test, revision, error query, and error message and may include other custom instrument driver VIs that perform operations such as calibration or storage and recall of setups.
The close VI terminates the software connection to the instrument and frees up system resources. Generally, the close VI only needs to be called once at the end of your application or when you finish communication with your instrument. You should make sure that for each successful call to the initialize VI, that you have a matching close VIotherwise you will be maintaining unnecessary memory resources.
![]() | Note Application functions do not call initialize and close. To run an application function, you must first run the initialize VI. The Getting Started VI calls initialize and close. |