Print

Tutorial 1: Getting Started with a 30-Day LabVIEW Evaluation

30-Day Evaluation Version

Download a free 30-Day trial of LabVIEW from here: http://www.ni.com/trylabview/.  After you have finished downloading, return to this tutorial for instructions on how to install and get your first Hello World program written.

Click on "Install LabVIEW 2009," and select the default options.

Now you will be prompted for a Serial Number, if you have one you may enter it, otherwise, leave this blank for a 30-day evaluation.

The default installation options should be fine for you if you do not already own any National Instruments hardware.  It will also be easy for you to select "Do not Install Device Drivers" under the NI Device Drivers option.  (You will be asked to download the Device Drivers separately when you reach our FPGA tutorials.)

Wait a few minutes whilte LabVIEW installs...

 

Your First LabVIEW Program

After you have finished installing, you must restart your computer.  when your system comes back up, launch LabVIEW and you will see this welcome screen:

Click on "Blank VI", under the "New" heading.  This will create a blank VI, which stands for Virtual Instrument, which is the LabVIEW equivalent of a function and is the heart of LabVIEW programming.  A VI consists of two windows, a "Front Panel," which contains the user interface, and a "Block Diagram," which contains the "source code."

So writing your first LabVIEW program is really quite simple, first, start off by activating the Front Panel, and right clicking to select a control to place onto the diagram.  Right-click anywhere on the grey area, and click on “Num Ctrls”, another sub-menu shall appear, and you can select the “Num Ctrl” control.  Left click to place this button anywhere on the Front Panel.

This is what you should have after placing the "Num Ctrl" onto the front panel.

Now you can right-click on the control and select "Find Terminal" to find it on the Block Diagram, which will allow you to access the value in the control.

After you left-click the "Find Terminal" option, you will get a screen like this:

Now we will perform a simple mathematical operation on the value stored inside this “Numeric” control. Right click anywhere on the white area of the “Block Diagram” and select “Arith & Com…”->
“Numeric”->Square, and place it to the right of the “Numeric” control that you placed in the prior step.

Which will give you this:

As you probably have guessed, this program will take the value that is contained inside the Numeric control, square it and send the output to wherever you like.  For this example, we will output that value directly to the user, so now right-click on the right outermost edge of the square VI, and select “Create Indicator’

This will create a small orange square with the text "x^2" as its title.  This represents an indicator, which will display the results of the previous square operation.

Now your program is ready to run! Switch back to the Front Panel Windows, you can press CTRL+E as a faster way to finding it with your mouse.  Rearrange the controls so that they appear to your liking, and then enter a value into the numeric control by clicking on the number 0.  Now you can run this program by either pressing CTRL+R or by clicking on the “Run” icon, which is the arrow pointing to the right in the toolbar.

Now you will see the square of the number that you just entered into Numeric control appear in the control labeled x^2.  In LabVIEW, controls that display outputs are typically referred to as indicators.

Now, what about the whole Hello World part? Well… To show you how simple LabVIEW makes programming, I am going to now introduce you to the rest of the Pallete of Vis that you have available to use.  Right click on the background area of the Block Diagram, and this time click on the downwards facing arrow  at the bottom of the palette menu:

You will now have an expanded Functions window:

Most of the general functionality of the LabVIEW programming language can be found inside the "Programming" tab, other hardware and instruments specific functions/VIs can be found in the rest.

Take some time now to explore what exists in each VI, and when you are finished come back here to continue this tutorial.

Hello World! in LabVIEW

Right-click on the white background and select the following function:

"Programming->String->Format Into..."

Now, the “Format Into” VI is just like using printf, but much easier, all you have to do is click on the orange wire that comes out from the squared VI and wire/connect it into the orange input on the Format Into VI.  This is what your program should look like when you are finished:

Now, we will take the resulting string, and add the words "Hellow World!" to it.

Right click on the "Initial String" terminal of the "Format Into" VI, and select "Create Constant"

Afterwards, you should see this:

You can now click inside the Red colored box and enther this string (without the quotes): "Hello World!"

Now, right click on the "resulting string" box of the Format Into VI and select "Create->Indicator"

Your program is now complete and should look something like this:

Note: You may have noticed that my program appears much cleaner than yours, which is true. Part of the reason is that I have written thousands of LabVIEW programs and have much experience setting this up.  There is a tool that you can use that easily cleans all or part of your program called the Diagram Cleanup tool. It is located at the end of the toolbar and looks like this: Select a portion of your code, and click that button and it cleans everything up! You can read more about it at Nis website.

Here is what the program looks like after I execute Diagram Cleanup:

Now, to execute your program, simply go back to the Front panel and click on the Run button and watch it go! Hello World!

Now you know how to make a simple LabVIEW program, I recommend visiting National Instruments Website to learn more where you can continue learning about LabVIEW and its programming environment.

 

 

Add comment


Security code
Refresh