1. Create a DLL from the Original LabWindows/CVI Instrument Driver
A LabWindows/CVI instrument driver typically includes the following files:
Table 1. LabWindows/CVI Instrument Driver Files
|source code for the instrument driver|
|header file for the instrument driver|
|contains information defining the driver function tree, function panels and help text|
.txt or similar
|an ASCII text file containing the documentation for the instrument driver|
The following example explains how to convert the LabWindows/CVI instrument driver for the Fluke 45 DMM.
From the downloaded files, the following are required for this example:
1. Launch LabWindows/CVI and open an .fp file.
From the File menu, select to open a function tree (*.fp) file. When prompted, navigate to the location of your installed instrument driver and load the function tree (*.fp) file, as shown in Figure 1.
Figure 1. Loading a Function Tree File
2. Create DLL project from instrument driver.
From the Options menu, select Create DLL Project to generate a project (.prj) file that can be used by LabWindows/CVI to create a DLL. Specify a pathname for the project and when prompted, load the project into LabWindows/CVI.
Your project window should now show the project ready for compilation into a DLL, as shown in Figure 2.
Figure 2. LabWindows/CVI Project Window
3. Create DLL from files generated in previous step.
From the Build menu, ensure that the Target Type is a Dynamic Link Library and Configuration is Release.
Note: To check the versioning information select Build»Target Settings»Version Info. The default version of the newly created project is 184.108.40.206/1.0 and the default DLL version is 220.127.116.11.
Next select Build»Create Release Dynamic Link Library, as shown in Figure 3.
Figure 3. Building a Release Dynamic Link Library
Once the DLL has been successfully created, you should see the message shown in Figure 4.
Figure 4. Successful DLL Creation Dialog
In addition to a DLL, this process generates the import libraries (in the Borland and msvc folders). You use only the DLL in this exercise, as you ultimately will call the DLL from LabVIEW.
2. Convert a Function Panel (.fp) File for Use within LabVIEW
Now that you have created a DLL from the original LabWindows/CVI instrument driver, you can use the LabVIEW Interface Generator for LabWindows/CVI Instrument Drivers tool in LabVIEW to generate a VI for each of the user-selected functions found in the original instrument driver.
1. Specify the LabWindows/CVI instrument driver function panel (.fp) file.
From the Tools»Instrumentation menu in LabVIEW, select Import CVI Instrument Driver (or Create VI Interface to CVI Instrument Driver in LabVIEW 8.0) to launch the tool. Choose either the Basic (recommended) or Advanced option. For more details on either option select help at any time.
On the next dialog window, specify the function panel (.fp) file you want to import as shown in Figure 5.
Figure 5. Selecting the Function Panel File to Convert
2. Build the LabVIEW Wrapper.
Click Next to go to the next dialog window where a summary of automated tasks is displayed. Click Next again to start the build process.
The conversion process goes through the list of automated tasks, displaying the names of the VIs being generated and their progression.
When the conversion is complete, you can select either to view the conversion report or view the VI Tree of the generated LabVIEW wrapper. The report, as shown in Figure 6, provides information about errors and/or warnings that occurred when generating the wrapper for the driver.
Figure 6. Sample of a Conversion Report
3. Examine the Converted LabVIEW Instrument Driver
Once the build process is complete, your LabVIEW/instr.lib/fl45 directory should include a VI library containing VIs for all the functions converted. The DLL must be located in the VXIpnp\WinNT\bin directory. Open the VI library from within LabVIEW and examine some of the newly created VIs.
Notice that each block diagram contains a single Call Library Function node. This node is configured to call the DLL. If you want to move the imported instrument driver to another computer, you must include both the VI library and the DLL.
Note: Prior to LabVIEW 8.0, a similar .fp file import feature was built into LabVIEW.