Download presentation
Presentation is loading. Please wait.
Published byIris Greer Modified over 9 years ago
1
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14
2
LabVIEW Facts Graphical language vs. text based language LabVIEW code consists of two parts: Front Panel and Block Diagram Programs called “VI” for “Virtual Instrument” Data moves along wires in a picture instead of stored in variables
3
LabVIEW – Front Panel
4
LabVIEW – Block Diagram
5
Controls Vs. Indicators Controls User input Examples: Buttons, Knobs, Switches On Block Diagram, wires connect to right side Indicators Output to user Examples: LEDs, Numeric Indicators, Dials, Graphs On Block Diagram, wires connect to left side
6
Variable Types Used Today String: text – Pink wires, indicators and controls Integer: no decimal points – Blue wires, indicators and controls Double Precision Floating Point: numbers with decimal point – Orange wires, indicators and controls Boolean: True or false – Green wires, indicators and controls
7
Structures Used Today While Loop: runs loop until user stops VI Case Statement: chooses which segment of code to execute
8
Hello World! Simple vi Displays text (string): “Hello World!” Runs until “STOP” button pressed – While loop
9
Hello World!
10
Hello World, Part II Replace While Loop with a For Loop – Right click on the loop, select “Replace with For Loop” Add a Loop Counter – Right click on the left side of the N icon, select “Add Constant” – Type 10. Loop will execute 10 times Delete the Stop Button Run!
11
Too Fast? Slow it down. – Add a “Wait ms” – Right click on the left side and add a constant 1000 – Should look like:
12
Hello World, Part III Switch chooses between displaying text “Hello World” and “Sleeping” (Case Structure) Runs until “STOP” button is pressed
13
Hello World, Part II
14
Numeric Fun User inputs a number via a knob VI displays data on a graph Samples at 10 Hz Runs until “STOP” button is pressed
15
Numeric Fun
16
Data Flow Programming A node will execute when all of its inputs are met If all inputs are met on several nodes, we cannot say which will execute first! Be careful with this, especially when writing to a file, accessing an instrument, etc!
17
Data Flow Programming Example #1 What order will these nodes execute?
18
Data Flow Programming Example #1 Add, Multiply and Subtract
19
Data Flow Programming Example #2 Which order will these nodes execute?
20
Data Flow Programming Example #2 Multiply is last The order of Add and Subtract is indeterminate
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.