Download - How to Labview
-
8/14/2019 How to Labview
1/49
AOE 3054 LabViewProgramming
-
8/14/2019 How to Labview
2/49
Starting LabView Lets begin by
opening LabView From the Start Menu,
Locate and start
LabView 8.2
If this is your first time runningLabView you may get aWindows Security Alert dialog. Ifso, select the Unblock button.
You may also get a Welcometo Labview dialog. In that case
just select the Continue button.
-
8/14/2019 How to Labview
3/49
LabView Programs
To begin a new program(or VI) click the NewBlank VI icon
National Instruments uses
programs that are called VIs.This stands for VirtualInstrument . It considerseach program a tool as onewould use a meter oroscilloscope.
-
8/14/2019 How to Labview
4/49
Programming Environment
The front panel is where we put the controls (buttons,knobs, etc) and indicators (Lights, displays or graphs).
The Block Diagram is where the graphical program will be.
The controls window will also appear which contains objectswhich can be moved to the front panel.
What appears isthe programming environment . It consists of twowindows, theFront Panel andthe Block diagramwindows.
-
8/14/2019 How to Labview
5/49
-
8/14/2019 How to Labview
6/49
Select Numeric Control
Clicking this will attach to the pointer a control outline and youcan select where you want it placed on the Front Panel.
Place one in the upper left portion of the panel
Controls Palletshold all kinds offront panel objects.The express palletis the third menu
choice in the popuplist. From it youcan get to thecommonly usedcontrols.
-
8/14/2019 How to Labview
7/49
Rename the control Degrees C
After you drop the control, it highlights the name ready for you to rename it.Just drop the control and start typing the name Degrees C. You canalways go back and double click the name to change it. Changing the nameas you place it will speed up programming time when you are doing largeprograms.
-
8/14/2019 How to Labview
8/49
Rename the control Degrees C
After you drop the control, it highlights the name ready for you to rename it.Just drop the control and start typing the name Degrees C. You canalways go back and double click the name to change it. Changing the nameas you place it will speed up programming time when you are doing largeprograms.
-
8/14/2019 How to Labview
9/49
Observe the Block Diagram
Notice the Block diagram has a terminal for the controlyou just placed on the front panel, and the controls palletchanges to the functions pallet.
-
8/14/2019 How to Labview
10/49
Viewing options
By default Labview displaces objects on theblock diagram as icons. By right clicking onan object you display the object as a smallerblock which makes larger programs easier tosee.
Icon view
Block view
Clicking the tack at the top of theexpress menu will allow you to keepthis menu on the screen when in theblock diagram
-
8/14/2019 How to Labview
11/49
-
8/14/2019 How to Labview
12/49
Block Diagram Program Now go to the Block Diagram Page.
Right clicking in LabView is the key to doing mostanything.
From the Diagram a right click will open a similar toolpallet, but specific to block diagram programming.
-
8/14/2019 How to Labview
13/49
Block Diagram-Right Click
Right Click forfunction palletto appear
-
8/14/2019 How to Labview
14/49
Block Diagram-Right Click
Click the tack on theexpress pallet tokeep this pallet onthe screen.
-
8/14/2019 How to Labview
15/49
Block Diagram-Right Click
Functions are grouped into categories. We will see more as we go.
Like the express controls pallet , oneexists forFunctions. Thecommon functionsare accessed fromthis main pallet.
-
8/14/2019 How to Labview
16/49
Block Diagram-Right Click
Search button
Also try the search button on this menu as it allows you to search the vasttoolbox.
-
8/14/2019 How to Labview
17/49
-
8/14/2019 How to Labview
18/49
Multiply
And place it near the Degrees C Terminal.
-
8/14/2019 How to Labview
19/49
Add
In the same manner place an addition function on the block diagram.
-
8/14/2019 How to Labview
20/49
Constants
Now hover over the lower terminal on the multiply function and rightclick.
-
8/14/2019 How to Labview
21/49
Constants
Hover over the menu item Create then select Constants.
-
8/14/2019 How to Labview
22/49
Constants
Then enter 1.8 for the constant value. Entering this now will save youhaving to select it again later.
-
8/14/2019 How to Labview
23/49
-
8/14/2019 How to Labview
24/49
Wiring
Wiring the vi determines the flow of the data calculations. To wirethe C to F converter, hover over the terminal on the right of theDegrees C Control.
The cursor automatically will switch to the wiring tool that lookslike a spool of wire. If it does not, select Auto from the tools pallet.
Click and hover over the remaining terminal on the multiplyfunction. Then click to set the wire in place. You can also click-drag to connect the terminals.
-
8/14/2019 How to Labview
25/49
Complete Wiring
-
8/14/2019 How to Labview
26/49
-
8/14/2019 How to Labview
27/49
Sub-VIs Any VI can be used by another VI.
To transfer the information, we must set up ameans to give the VI data and to get data from it.
Terminals can be assigned to Front Panelobjects.
For inputs , use controls . For outputs , use indicators .
-
8/14/2019 How to Labview
28/49
Add Terminals
Right Click the Icon for the VI in the upper right corner.
-
8/14/2019 How to Labview
29/49
Add Terminals
Select Show Connector.
-
8/14/2019 How to Labview
30/49
Set terminal pattern
Depending on the number of inputs and outputs your VI will use youcan select an appropriate terminal pattern by right clicking on theterminal again.
Our VI has one input and one output so we select the appropriateterminal pattern from the list.
-
8/14/2019 How to Labview
31/49
Add Terminals
Click the terminal onthe left.
-
8/14/2019 How to Labview
32/49
-
8/14/2019 How to Labview
33/49
Add Terminals
This control is now associated with the terminal on the left.Whatever you connect to that terminal in another vi will beused as the input data for this vi.
-
8/14/2019 How to Labview
34/49
Add Terminals
For program flow and consistency, always try to put inputs onthe left and outputs on the right.
So, now lets hook up the output.
Click the rightterminal.
-
8/14/2019 How to Labview
35/49
Add Terminals
Then select theindicator as the
output.
-
8/14/2019 How to Labview
36/49
Add Terminals
This indicator is now associated with the terminal on theright. Data from this terminal is sent to the VI using this sub-VI.
-
8/14/2019 How to Labview
37/49
-
8/14/2019 How to Labview
38/49
Save The VI From the file menu, select Save
Appropriately name the VI and save in aconvenient location.
Close the VI. Closing the Front panel closes bothwindows.
Closing the block diagram leaves the frontpanel and the VI open.
-
8/14/2019 How to Labview
39/49
Using the sub VIs Open a new Blank
VI from theFile>New menu
On the BlockDiagram, open thefunctions palletand choose awhile loop(appears in theExpress palletunder Exec Cntlgroup).
-
8/14/2019 How to Labview
40/49
Place the While Loop
Click in onecorner
Then click in theother corner.
-
8/14/2019 How to Labview
41/49
Sub-VIs
Add our sub-VI that we created before.
Right Click
-
8/14/2019 How to Labview
42/49
Custom VIs
And Select Custom VIs.
-
8/14/2019 How to Labview
43/49
Place the Sub-VI
Locate the vi inside the while loop and click to place it.
Hover over the terminals on the left and right to see what is available.
Right-Click over theLeft terminal andselect create control.
-
8/14/2019 How to Labview
44/49
Create Control
-
8/14/2019 How to Labview
45/49
Add Indicator
Do the same for the output on the right terminal, exceptselect create Indicator .
-
8/14/2019 How to Labview
46/49
Complete wiring
Switch to the Front Panel.
-
8/14/2019 How to Labview
47/49
-
8/14/2019 How to Labview
48/49
Stopping VIs
Preferred Stopbutton.
Use this stop only when nothing else works! The abort button willhalt execution immediately, which might not be good if the code
needs to close com ports or save files before exiting.
-
8/14/2019 How to Labview
49/49
What was learned about LabView? Create new VIs from the beginning.
Use of numeric controls and indicators. Block Diagram Wiring and Data Flow.
Creating and Using Sub-VIs. While loops.