Presentation on theme: "Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14."— Presentation transcript:
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14
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
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
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
Structures Used Today While Loop: runs loop until user stops VI Case Statement: chooses which segment of code to execute
Hello World! Simple vi Displays text (string): “Hello World!” Runs until “STOP” button pressed – While loop
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!
Too Fast? Slow it down. – Add a “Wait ms” – Right click on the left side and add a constant 1000 – Should look like:
Hello World, Part III Switch chooses between displaying text “Hello World” and “Sleeping” (Case Structure) Runs until “STOP” button is pressed
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!
Data Flow Programming Example #1 What order will these nodes execute?
Data Flow Programming Example #1 Add, Multiply and Subtract
Data Flow Programming Example #2 Which order will these nodes execute?
Data Flow Programming Example #2 Multiply is last The order of Add and Subtract is indeterminate