You are on page 1of 12

LAB REPORT 2

AV-356

GOHAR ALI
18092002  (92-A)
GOAL: 
Use the debugging tools built in the Lab view. 

PROCEDURE: 

Edit time errors: 


Open and examine the area and validity of a triangle VI. 
 Open Debug.lvproj in the <Exercises>\LabVIEW Core 1\Debugging directory. 
 Open Area and Validity of a Triangle VI from the Project Explorer window. 

 Notice the Run button on the toolbar appears broken, indicating that the VI is
broken and cannot run. 
Display and examine the block diagram of Area and Validity of a Triangle VI shown
in Figure. 

This VI takes input values for each of the three sides of a triangle, passes the values
into a sub VI that determines the area, and checks that the values entered are valid
for a triangle. 
 
 
 
Find and fix each error. 

 Click the broken Run button to display the Error list window, which lists all the
errors. 
 Select an error description in the Error list window. The Details section describes
the error and, in some cases, recommends how to correct the error. 

 Click the Help button to display a topic in the LabVIEW Help that describes the
error in detail and includes step-by-step instructions for correcting the error. 
 Click the Show Error button or double-click the error description to highlight the
area on the block diagram that contains the error. 

 Use the Error list window to fix each error. 

Run time errors: 


Test the VI. 

 Display the front panel by clicking it or by selecting Window» Show Front Panel. 

 Use the default values for each side. These values are valid measurements for a
triangle. 
 Run the VI. 
 Notice that although the numbers you entered are valid, the LED is not illuminated
and the Area of a Triangle indicator displays NaN. 
Animate the flow of data through the block diagram. 

 Display the block diagram. 

 Click the Highlight Execution button on the toolbar to enable execution highlighting 
Click the Retain Wire Values button on the toolbar so you can see the last value
passed on a wire 
 
 
 Run the VI. 
Notice that you can see how data flows through the wires. At the output of each
node, you can see the data value displays momentarily. Because you have enabled
the Retain Wire Values button, you can probe the last value in the wire. 

One can see the values at the output of each of the components in the diagram. 
 Because you are checking to see that all three sides of the triangle have
positive lengths, either the input value is invalid or the logic is incorrect. 
The input values were all positive numbers, so that means the logic is incorrect. 
Notice that the node returning a value of False is a Less than Zero? function, but this
section of code should be checking to see if the value is greater than zero. 
 Right-click the Less than Zero? function and select Replace»
Comparison Palette» Greater than Zero? 
 
 
Test the VI. 
 Run the VI. 
 Notice that all the probe values are all True. 
 Display the front panel. Notice that the Valid Triangle? LED is illuminated, but
the Area of Triangle indicator is still returning NaN. 
 The area of the triangle is calculated in the sub VI, so you must continue
debugging in the Area of a Triangle sub VI. 

 
 
 
 

Continue debugging the subVI. 


 Display the block diagram of the Area and Validity of a Triangle VI. 
 Click the Step Into button to start single-stepping through the VI. Execution
highlighting shows the flow of data on the block diagram from one node 
to another. Nodes blink to indicate they are ready to execute. 
 Click the Step Over button after each node to step through the entire block
diagram until you get to the subVI. Each time you click the Step Over 
button, the current node executes and pauses at the next node. 
 When you get to the subVI, click the Step Into button to open the block diagram
of the Area of Triangle subVI. The subVI is paused. 
 Turn on Execution Highlighting and Retain Wire Values in the subVI. 
 

 
 
 Right-click the output of the Square Root function and select Breakpoint»
Set Breakpoint. 
 
 
Click the red pause button to resume the execution of the VI. 
 The VI continues executing until the breakpoint and then pauses again. 
 
Examine the values on the wires 
 Move the cursor to hover over the input wire of the Square Root function. You
should see a tip strip with a value of -576. You cannot take the square root of a
negative number, which is why the Area of Triangle indicator returns NaN. 
 Notice that the value on the (S-B) wire is also a negative number. If you look
more closely, you notice that the inputs for the subtract function are reversed. 
Switch the inputs for the (S-B) Subtract function. 
 

Test the Area of Triangle VI. 

 Run the VI again. 


 Check the intermediate values as the VI runs or hover over the wires after it
pauses at the breakpoint and verify that the values returned are correct. 
The square root function should return a value of 24. 
 Save both VIs. 

 
Test: 
Now we check the VI by putting different values of a, b and c. 
 

 
 
 

 
 

 
 
 

You might also like