Wrap It Up


Wrap It Up!

In this chapter, we mined some of LabVIEW's gemstones: local variables, global variables, shared variables, property nodes, and invoke nodes. The power and versatility offered by these structures and functions allow you to go a level deeper into programming applications in LabVIEW.

Local variables allow you to create a block diagram "copy" of a front panel object, which you can read from or write to in different places. Global variables are similar to locals, but they store their data independently of any particular VI, allowing you to share variables between separate VIs without wiring them together. Locals are very useful for controlling parallel loops or updating a front panel object from multiple locations in the diagram. Globals are a powerful structure, but care is required in their use because they are prone to cause problems. Shared variables are useful for storing buffered data that is going to be shared between VIs or across a network.

Property nodes give you immense control over the appearance and behavior of indicators and controls, allowing you to change their properties programmatically. Every control and indicator has a set of base properties (such as color, visibility, etc.). Many objects, such as graphs, have numerous properties that you can set or read accordingly.

The Event Structure is an extremely useful structure that lets you do true event-driven programming, and you'll want to use this often to handle GUI events.

We saw how type definitions are handy for making a "master" copy of a data structure or control you might be using in several places, and how the instances of that typedef can be updated automatically by just updating the typedef control.

You learned that the state machine, using a combination of a While Loop, a Case Structure, and shift registers, offers a foundational programming pattern that virtually all advanced LabVIEW developers rely on.

Messaging and Synchronization functions allow you to send messages across applications. Queues allow one or more message producers to send messages and data to a single consumer. Notifiers allow one or more message producers to send status information and data to one or more message consumers. Semaphores allow shared resources to be locked and unlocked to avoid race conditions and other resource contention issues. Rendezvous allow parallel processes to "meet up" at waypoints before proceeding. Occurrences are low-level dataless event messages that are lightweight and efficient (but with much fewer features than the other messaging functions). The First Call? function tells you when a subVI or block of code is called for the first time, allowing you to conditionally run initialization code only once.

Finally, we examined some cool GUI widgets and learned how to integrate sound and graphics into our application.




LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net