beautypg.com

Vi logic, End of activity 12-1 – National Instruments BridgeVIEW User Manual

Page 267

background image

Chapter 12

Case and Sequence Structures and the Formula Node

BridgeVIEW User Manual

12-4

© National Instruments Corporation

One Button Dialog function (Functions»Time & Dialog)—In this
activity, the function displays a dialog box that contains the message

Error...Negative Number

.

String Constant (Functions»String)—Enter text inside the box with
the Labeling tool.

The VI executes either the TRUE case or the FALSE case. If the
number is greater than or equal to zero, the VI executes the TRUE case
and returns the square root of the number. The FALSE case outputs
–99999.00 and displays a dialog box with the message

Error...Negative Number

.

Note

You must define the output tunnel for each case. When you create an output
tunnel in one case, tunnels appear at the same position in all the other cases.
Unwired tunnels appear as white squares.

4.

Return to the front panel and run the VI. Try a number greater than zero
and a number less than zero by changing the value in the digital control
you labeled

Number

. Notice that when you change the digital control

to a negative number, BridgeVIEW displays the error message you set
up in the FALSE case of the Case structure.

5.

Save the VI as

Square Root.vi

in the

BridgeVIEW\Activity

directory.

VI Logic

The block diagram in this activity has the same effect as the following
pseudocode in a text-based language.

if (Number >= 0) then

Square Root Value = SQRT(Number)

else

Square Root Value = -99999.00

Display Message "Error...Negative Number"

end if

End of Activity 12-1.