Wednesday, August 18, 2010

Getting Started part 1





When you start LabView 8, you will see the Getting Started screen. Earlier versions may not have this screen and may automatically come up with a blank program. To get started trying things on your own, you will want to click "Blank VI" under the "New" Section on the left. "Empty Project" would start a new project. LabView Projects are a relatively new feature and not necessary to learn at this point. VI from Template is an advanced LabView feature which allows you to create templates as starting points for your development. Again, this is an advanced feature so we will skip it for now. You will start a "Blank VI" and in the future, you can open recently created LabView programs from the "Open" section.

A "VI" is a LabView program which is contained in a file with a .vi extension. Every time you create a LabView program you will end up saving a .vi file. This file is binary in nature so opening it in a text editor such as notepad will be of limited use.

When you start, you will typically see a "Front Panel" which is a window with a grey background:

This is the graphical user interface (GUI) for your program, where you (and others) will interact with it while it is running. It is definitely not much to look at yet, but it can be, and you will be surprised at how easy it is to build a nice interface quickly in LabView.


The "Block Diagram" appears to be similar to the "Front Panel" to a novice user , other than the fact that it has a white background instead of grey. In fact, this window is where the program will actually be written. When you develop the block diagram, you are actually writing the program that makes the front panel operate as you desire. It is here that you will make the computer perform calculations, write files, communicate with hardware, etc. This view of the VI is what most programmers would call a "program" or "source code".

Block Diagram:

You will notice that if you select one window or the other in LabView 8.5, you will see a context sensitive menu appear. There are menus associated with the Front Panel and Block Diagram that allow you to do everything you need to do to design your user interface and implement the logic that makes it work.


Block Diagram Menu

Front Panel Menu
To see how easy it is to design user interfaces, lets first go to the front panel. Once you do that, click on the menu where it says "Num Ctrls" and notice that you have navigated deeper in the menu system:

All the items at this level in the menu are "Controls". Controls are user interface elements that you can place on the Front Panel. There are also "Indicators" which are not shown in this menu. Controls allow you to input something into your program. That means you get to change the value and affect the program while it is running. Indicators output results from the program. You cannot change their value. They are your way of seeing what has happened.

If you click on "Num Ctrl" in the menu, you can then drop a control on the front panel that will allow you to enter a number. Its as easy as that.


Front Panel with Numeric Control dropped on it from the menu:


Now you will notice something automatically happened on the Block Diagram. A "terminal" appeared corresponding to the Control that was dropped. In your LabView code, this terminal represents the number entered on the front panel control. If you type in 3.2 in the control, then this terminal in your code is a representing that number. You will soon see that you can wire the terminal to other elements in the Block Diagram to create a picture that looks like a flowchart, schematic, or blueprint, which defines what the program should do. This terminal serves as a starting point for the value you have entered and you will be able to connect it to the input of another element.


Before we go further, lets look at how the menus operate so you know how to interact with it and explore the possibilities. You have seen the default menu for the front panel and block diagram, and you have used the front panel menu to place a numeric control. Lets start with this front panel menu. First, try right clicking on the front panel. You will see that the same menu appears as a pop up. Left click somewhere else to make it go away.


At the bottom of the menu you will see a strip like this:

If you click it, you will see that the menu expands providing you with a large number of submenus. The default menu gives you the options that National Instruments believes will be most common or make the program easiest to use for beginners. Many of these are "Express" menus which provide some built-in functionality. We are going to dig into classic LabView programming to make sure you get a solid foundation first. To do this, you will need to become familiar with expanding and navigating the menu as time goes on. You may find that it is easier to right click on the LabView windows to pop up menus as you need them rather than using the windowed ones.

Now try navigating to the full featured numeric control and indicator menu on the front panel. You should be able to use what you've learned to do that. Here is a picture that shows exactly how you navigate there in LabView 8.5. (Hint: Expand the menu)

You see the numeric indicator highlighted by the mouse cursor in the above screen capture. Remember, an indicator provides a value to the user rather than allowing the user to enter the value. Place an indicator in much the same way as you did the control. Select it from the menu and drop it on the user interface. You will see that an indicator terminal appears on the block diagram. You can distinguish the two by the thickness of the border around the terminal on the block diagram and by the color of the default background on the front panel (white for controls, grey for indicators).
Indicator Placed on Front Panel:

Both terminals visible on the Block Diagram:

I have run out of time for today, but this lesson will be continued with the next post.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Popular Projects

My Blog List

Give support

Give support
Encourage Me through Comments & Followers

Followers