Presentation is loading. Please wait.

Presentation is loading. Please wait.

Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 8 Other Structures; Local Variables  Read Bishop, Sections 5.6 to 5.12.  Lab #8 and Homework #8 due.

Similar presentations


Presentation on theme: "Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 8 Other Structures; Local Variables  Read Bishop, Sections 5.6 to 5.12.  Lab #8 and Homework #8 due."— Presentation transcript:

1 Floyd, Digital Fundamentals, 10 th ed 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

2 Floyd, Digital Fundamentals, 10 th ed Review: Structures  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

3 Floyd, Digital Fundamentals, 10 th ed Entering Formulas

4 Floyd, Digital Fundamentals, 10 th ed Formula Node  The Formula Node lets you type formulas using the same syntax used in C or C++.  Formulas must end in a semicolon (;).  To raise a number to a power, type **. For example, to set y equal to x 4, type y = x**4; (Bishop, pp. 250-253)

5 Floyd, Digital Fundamentals, 10 th ed 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)

6 Floyd, Digital Fundamentals, 10 th ed 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.

7 Floyd, Digital Fundamentals, 10 th ed Example of Diagram Disable Structure

8 Floyd, Digital Fundamentals, 10 th ed 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

9 Floyd, Digital Fundamentals, 10 th ed Creating Local Variables  To create a local variable, right-click the desired front panel object and select Create >> Local Variable. (Bishop, p. 257)

10 Floyd, Digital Fundamentals, 10 th ed 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)

11 Floyd, Digital Fundamentals, 10 th ed 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

12 Floyd, Digital Fundamentals, 10 th ed 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.


Download ppt "Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 8 Other Structures; Local Variables  Read Bishop, Sections 5.6 to 5.12.  Lab #8 and Homework #8 due."

Similar presentations


Ads by Google