EET 2259 Unit 8 Other Structures; Local Variables

Slides:



Advertisements
Similar presentations
LabVIEW Crash Course Presented by:.
Advertisements

LabVIEW is a graphical programming development environment for data acquisition and control, data analysis, and data presentation. With LabVIEW you can.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
Based on LabVIEW 2011 Student Edition
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 10 Clusters and Matrices  Read Bishop, Sections 6.4 to  Lab #10 and Homework #10 due next week.
De la Rosa-Pohl ECE 1100 Introduction to Engineering Intro to LabVIEW: Programming for Symon University of Houston Diana de la Rosa-Pohl Len Trombetta.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 5 Loops  Read Bishop, Sections 5.1 and 5.2.  Lab #5 and Homework #5 due next week.  Exam #1 next.
CS320n –Visual Programming LabVIEW Foundations. Visual ProgrammingLabVIEW Foundations2 What We Will Do Today Hand back and review the midterm Look at.
Loops A.About While Loops B.About For Loops C.About Case structures D.Sequence Structures E.Formula Node You Will Learn:
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 4 SubVIs  Read Bishop, Chapter 4.  Lab #4 and Homework #4 due next week.
Infinity-project.org Engineering education for today’s classroom The Infinity Project SM LabVIEW for The Infinity Project.
How to use LabVIEW Ihor Korolov February 2011.
Driver Station MVRT 2009 – 2010 Season. Add information Breadboard Classmate PC USB Hub Joysticks Stop Button.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 8 Other Structures; Local Variables  Read Bishop, Sections 5.6 to  Lab #8 and Homework #8 due.
LabView Basics The Fighting Pi Controls Group. About LabView LabView is a highly adaptable programming GUI (Graphic User Interface) LabView compiles the.
Virtual Instrumentation With LabVIEW. Course Goals Understand the components of a Virtual Instrument Introduce LabVIEW and common LabVIEW functions Create.
LabVIEW an Introduction
Introduction to LabVIEW
Each VI has 2 Windows Front Panel User Interface (UI) –Controls = Inputs –Indicators = Outputs Block Diagram Graphical Code –Data travels on wires from.
Part I MVRT 2011 – 2012 Season Introduction to LabVIEW.
LabView instrumentoinnissa, 55492, 3op Labview in instrumentation Lecturer: Heikki Ojala, room C204a
CS320n –Visual Programming More LabVIEW Control Structures.
LabVIEW – 2 Windows ► Front Panel- User Interface ► Block Diagram- Programming View.
Samuel Alberg Thrysøe, PhD, PostDoc, Kontakt info: Tlf:
EET 2259 Unit 7 Case Structures; Sequence Structures  Read Bishop, Sections 5.4 and 5.5.  Lab #7 and Homework #7 due next week.  Quiz #3 next week.
1. 2 LabVIEW Intro, Basics, Tips, Tricks Doug Norman & Stephanie Brierty National Instruments January 8, 2010.
Creating, Editing, & Debugging a VI A.How to Create VIs B.How to Edit VIs C.How to Debug VIs You Will Learn:
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 3 Editing and Debugging VIs  Read Bishop, Chapter 3.  Lab #3 and Homework #3 due next week.  Quiz.
Digital Electronics and Computer Interfacing Tim Mewes 4. LabVIEW - Advanced.
CS320n –Visual Programming More LabVIEW Foundations.
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 9 Arrays  Read Bishop, Sections 6.1 to 6.3.  Homework #9 and Lab #9 due next week.  Quiz #5 next.
EET 2259 Programming for Electronics Technology Professor Nick Reeder.
EGR 2131 Unit 4 Combinational Circuits: Analysis & Design
EET 2259 Unit 13 Strings and File I/O
Introduction to LabVIEW
EET 2259 Unit 4 SubVIs Read Bishop, Chapter 4.
EE 200 Design Tools Laboratory 14
EET 2259 Unit 11 Charts and Graphs
EGR 2261 Unit 5 Control Structures II: Repetition
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 3 Editing and Debugging VIs
Course Learning Map Lesson # Lesson Title Lesson 3 Lesson 2 Lesson 1
Introduction to LabVIEW
Lesson 2: Introduction to Control programming using Labview
Programming for Electronics Technology Professor Nick Reeder
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Doing some Boolean: On/Off
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
Structured Program
EET 2259 Unit 6 Shift Registers
LabVIEW.
EET 2261 Unit 8 Seven-Segment Displays
Structures- case, sequence, formula node
CST-115 Introduction to Computer Programming
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
Introduction to LabVIEW
EET 2259 Unit 9 Arrays Read Bishop, Sections 6.1 to 6.3.
EET 2259 Unit 13 Strings and File I/O
LabVIEW基礎課程(一) 參考書籍: LabVIEW for Everyone (Jeffrey Travis/Jim Kring)
Introduction to LabVIEW
EET 2259 Unit 7 Case Structures; Sequence Structures
EET 2259 Unit 5 Loops Read Bishop, Sections 5.1 and 5.2.
EET 2259 Unit 11 Charts and Graphs
EET 2259 Unit 2 Virtual Instruments
EET 2259 Unit 4 SubVIs Read Bishop, Chapter 4.
EET 2259 Unit 6 Shift Registers
Introduction to LabVIEW
EET 2259 Unit 3 Editing and Debugging VIs
Presentation transcript:

EET 2259 Unit 8 Other Structures; Local Variables Read Bishop, Sections 5.6 to 5.12. Lab #8 and Homework #8 due next week. Quiz #4 next week. Handouts: Quiz 3

Review: Structures This week we’ll look at: Structures control the flow of a program’s execution. We’ve looked at: For Loops While Loops Case Structures Sequence Structures (flat or stacked) This week we’ll look at: Formula Nodes Diagram Disable Structures Local Variables Global Variables

Entering Formulas You can perform just about any calculation using LabVIEW’s many built-in mathematical functions on the Functions >> Mathematics palette. A simple example: 𝑦=5sin⁡( 𝑥 4 + 𝑥 2 ) But for long, complicated formulas, there’s an easier way, called a Formula Node. Demo how to build the example using built-in functions.

Formula Node The Formula Node lets you type formulas. Formulas must end in a semicolon (;). To raise a number to a power, type **. For example, to set y equal to x4, type y = x**4; (Bishop, pp. 250-253) Use one to do example on previous slide. Then show various errors (missing semicolon, using Y instead of y, using ^ instead of **).

Diagram Disable Structure The Diagram Disable structure lets you disable specific sections of code on the block diagram. It is similar to commenting out code in a text- based programming language. (Bishop, p. 254)

Usefulness of Diagram Disable Structure This structure is primarily useful as a debugging tool. If you’ve got some code that you know or suspect is not working correctly, you can temporarily disable that code while you test the rest of your program. Eventually you’ll probably want to remove all diagram disable structures, after all of your code works correctly.

Example of Diagram Disable Structure -Send them this file (diagramDisableExample.vi) for demo purposes.

Local Variables Local variables let you access front panel objects from more than one location in a single VI. They pass information between objects that can’t simply be connected with a wire. (Bishop, p. 255) Local variable

Creating Local Variables To create a local variable, right-click the desired front panel object and select Create >> Local Variable. A silly example: Better to wire the button directly to the LED! Local variable Have them build it. Then use local variable for the pushbutton too, with the local variables connected to each other.

Use Local Variables with Care Since local variables are not inherently part of the LabVIEW dataflow execution model, overusing them or misusing them can make block diagrams difficult to read or create unpredictable situations. (Bishop, p. 257)

Local Variables: A More Useful Example Suppose that we want to turn off all the LEDs at the end of the program you wrote named P5_4_LEDSeqStruc.vi. It’s not easy, unless you use local variables. Local variables More useful, show how to use it to turn off all LEDs at the end of. (Add a frame with False wired to local variables for all three LEDs.)

Global Variables Local variables are called local because they only let you pass data from one place to another within a single VI. In LabVIEW you can also create global variables (not discussed in the text) that pass data between VIs running on the same computer. Global variable

Global Variables: An Example First VI: Place a global variable, open its front panel and place an LED named “Magic!”, save global variable as global.vi. Then inside a While loop, wire a switch to the global variable. Second VI: inside a While loop, place the same global (using “Select a VI…” on functions palette), change it to read, and wire it to an LED. Then run both VIs. -Shared Variables let you do similar things, but with VIs running on different computers connected via a network.

Use Global Variables with Extreme Care With global variables it can be very hard to see where data is going or where it’s coming from. Misusing them can make block diagrams very difficult to read and can create unpredictable situations. LabVIEW provides better ways to pass data between VIs, but they’re more complicated and more difficult to set up than global variables.