12 Finalizing Your LabVIEW Software

Once you’ve finally finished your project, there are certain steps you can take to lock your LabVIEW project, thus making sure it doesn’t get changed or damaged. A non-LabVIEW programmer ultimately runs every single DAQ project I’ve ever done, hence this chapter. And all of these users are usually bright and/or curious people who will probably have the urge to modify the software. This is generally a bad thing, regardless of the user’s intentions, for obvious reasons.

If you want to distribute your LabVIEW software to other computers, there are other steps you can take to make this distribution simple. These steps involve creating an. exe file by buying even more NI software, the LabVIEW Application Builder. Unlike other popular programming environments, LabVIEW hits you with a steep charge to distribute your application to other computers. This is one of the few disadvantages I see to using LabVIEW.

Section 12.1 describes how to protect your code from changes without building an .exe file, which may be useful if the code is still under development or on few machines. Section 12.2 describes how to protect your code by building an.exe file, which makes it even tougher to change the code, but requires the purchase of the LabVIEW application builder.

12.1 FINALIZING YOUR LABVIEW SOFTWARE ON YOUR DEVELOPMENT COMPUTER

The objective here is to make it unlikely for your users to modify your code. You could create a standalone executable file, something like My Tester. exe, but in my opinion, that’s not necessary on a machine that has LabVIEW installed. The subtle trickery shown in this section will make it very unlikely for anybody unfamiliar with LabVIEW programming to modify your VIs. Anybody who knows how to get around this soon-to-be-described trickery would also know how to build and overwrite your .exe file.

These steps are designed to allow the non-LabVIEW-knowledgeable user to fully run the VI, but to make it very unlikely that they can edit the VI.

1.   You should save a backup copy of all of your code somewhere other than your on hard drive. See Appendix E, item 2, for more details.

2.   Design your LabVIEW system so that one VI, called a top-level VI, controls every other VI.

▪  Make your top-level VI run when opened (check the File»VI Properties»Category»Execution»Run When Opened box).

▪  Make your top-level VI and all others whose front panels will be showing behave like a dialog box (click the File»VI Properties»Category» Window Appearance»Dialog button). Most important, no tool bars should be showing, hence no Abort Execution buttons and no built-in menu items will allow the user to reach any block diagrams, where they might find other Abort Execution buttons.

▪  Make your top-level VI exit when stopped (use the Functions»Application Control»Quit LabVIEW function). Otherwise, the user will wonder why things have “stopped working” when the VI has stopped. If your tool bar is hidden, as per item b above, this can make it hard for you, the developer, to edit the VI, since you have no Abort Execution button. So, use any kind of secret trick you want to allow stopping without exiting. I always place a little secret dummy file called testplat. txt in my application’s directory that causes the top-level VI to not exit when stopped; my code checks to see if testplat. txt exists, and if not, it exits, testplat. txt should only exist white you’re editing the LabVIEW code—rename it to testplat2. txt or anything else when you want to make it not exist. Finally, if your exit-prevention code does not work, and you cannot edit your VIs, simply rename any of your sub VIs; then you can open your top-level VI in a broken state, fix the exit-prevention code, then properly name the renamed subVI.

3.   To make it very easy for your user to run the VI, create a shortcut on the computer’s desktop to said VI.

12.2 MOVING YOUR LABVIEW SOFTWARE TO OTHER COMPUTERS

There are many fancy options you can use to build a distributable LabVIEW application, like creating a custom icon, but the following are the basic steps I recommend in order to move your LabVIEW executable code to other computers.

1.   Reach for your wallet and buy the LabVIEW Application Builder from NI and install it (unless you have it already).

2.   Follow steps 1 and 2 from the previous section, if you haven’t already.

3.   Open your top-level VI’s front panel, and stop it without exiting LabVIEW. Select the File»Save With Options… menu item. Click the Application Distribution button, then click the Save button, saving an. llb file to the same folder as your top-level VI.

4.   Close all VIs, then open a new one. You should have only one blank VI open at this point.

5.   Using the Tools»Build Application or Shared Library (DLL)… menu item (this menu item exists only if you have installed the LabVIEW Application Builder), bring up the window shown in Figure 12-1.

Figure 12-1
Main Window for building applications.

Image

6.   In the main window, do the following:

▪  In the Target tab, set the Application name field to your desired .exe file name.

▪  In the Target tab, set the Destination directory field the folder of your top-level VI.

▪  In the Source Files tab, click the Add Top-Level VI… button and find the.llb file you created in step 3, double-click it, then add the top-level VI within this. llb file.

▪  In the Installer Settings tab, check the Create Installer box, then set the various fields in this tab as you wish. I prefer installing all program files to my C: Program Files folder.

▪  Click the Build button, then watch your. exe file being built.

▪  Click the Done button, and create a script file (a .bld file) when asked so you can quickly rebuild later by reproducing these building steps with the Load… button, shown in Figure 12-1.

7.   Optional: Create a shortcut on your desktop to your newly created. exe file on each computer on which your software is installed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.171.153