INTRODUCTION
In this tutorial, you will create a VI
that utilizes a Case Structure to calculate the square
root of a given number and check to see if the input
number is negative. If it is, the VI returns a "-99999.0
value in the Digital Indicator and dialog-box error
message that is stored in a String Constant. The VI
will use a simple Boolean Case Structure that will
utilize a greater than or equal to function wired to
the selector terminal to determine whether to invoke
the square root calculation case (TRUE) or the error-display
case (FALSE).
- Start a New VI and
- Create the Front Panel and Block Diagram
shown above
- Run the VI, enter diff values and observe
the results
- Note: Do not
run this VI Continuously. It will create
an Endless Loop!
- Save the VI as: Square_Root_Case_Structure.vi
Below are some explanations of some Block
Diagram nodes that may be new to you:
 |
Greater
or Equal to 0? function compares the
X and Y inputs and returns a TRUE if X >=
Y. Otherwise it returns a FALSE. In this case,
the function returns a TRUE if the input number
is greater than or equal to the zero because
of the zero in the Numeric Constant wired to
the Y input.
|
 |
Square Root function
returns the square root of the input number.
Pop-up > Numeric > Square
Root
|
 |
Numeric
Constant You have used this before,
but this time pop-up on the constant > Format & Precision:

And modify the dialogue box so
that the format is Decimal with 1 digit of
Precision and Floating Point Notation:
|
 |
String Constant outputs
string data of whatever text is typed inside
it.
Pop-up > Strings > String
Constant:
|
 |
One Button Dialog function displays a dialog box that contains a message contained in the String Constant. Wire a constant to the upper-left hot-spot and type the message inside.
Pop-up > Time & Dialog > One
Button Dialog

|