Professional Documents
Culture Documents
AV-356
GOHAR ALI
18092002 (92-A)
GOAL:
Use the debugging tools built in the Lab view.
PROCEDURE:
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 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.
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.
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:
Now we check the VI by putting different values of a, b and c.