Activity 5-1: Debugging Challenge


In this activity, you will troubleshoot and fix a broken VI. Then you will practice using other debugging features, including execution highlighting, single-step mode, and the probe.

1.

Open up the VI called Debug Exercise.vi, located in EVERYONE\CH05.

2.

Switch to the block diagram, which is shown in Figure 5.9. Notice that the run arrow is broken. You must find out why and rectify the situation so the VI will run.

Figure 5.9. Debug Exercise.vi block diagram, which you must debug during this activity


3.

Click on the broken run arrow. An Error List dialog box appears, describing the errors in the VI.

4.

Click on the "Add: contains unwired or bad terminal" error. The Error List window, shown in Figure 5.10, will give you a more detailed description of the error. Now double-click on the error, or click the Find button. LabVIEW will highlight the offending function in the block diagram, to help you locate the mistake.

Figure 5.10. Error list dialog showing the errors that are present in Debug Exercise.vi and prevent it from running


5.

Draw in the missing wire. The Run button should appear solid. If it doesn't, try to Remove Broken Wires.

6.

Switch back to the front panel and run the VI a few times.

7.

Tile the front panel and block diagram (using the Tile command under the Windows menu) so you can see both at the same time. Enable execution highlighting and run the VI in single-step mode by pressing the appropriate buttons on the Toolbar in the block diagram.

Execution Highlighting Button

8.

Click the Step Over button each time you wish to execute a node (or click the Step Out button to finish the block diagram). Notice that the data appears on the front panel as you step through the program. First, the VI generates a random number and then multiplies it by 10.0. Finally, the VI adds 100.0 to the multiplication result. Notice how each of these front panel indicators is updated as new data reaches its block diagram terminals, a perfect example of dataflow programming. Remember, you can exit single-step mode and complete the VI by pressing the Pause button. Also notice that the tip strips describing the single-step buttons change text to give you an exact description of what they will do when you click them, given the context of where you are.

Step Into Button

Step Over Button

Step Out Button

9.

Now enable the probe by popping up on any wire segment and selecting Probe.

10.

Step through the VI again and note how the probe displays the data carried by its corresponding wire, as shown in Figure 5.11.

Figure 5.11. Debugged Exercise.vi block diagram


11.

Turn off execution highlighting by clicking its button. You're almost done . . . .

12.

Save your finished VI in your MYWORK directory by selecting the Save As . . . option from the File menu so you won't overwrite the original. Name it Debugged Exercise.vi. If you're feeling adventuresome, or if you think an LLB will suit your needs, try creating an LLB and saving your work again in it for practice.

13.

Close the VI by selecting Close from the File menu. Good job!




LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net