Book Image

Data Acquisition using LabVIEW

By : Behzad Ehsani
Book Image

Data Acquisition using LabVIEW

By: Behzad Ehsani

Overview of this book

NI LabVIEW's intuitive graphical interface eliminates the steep learning curve associated with text-based languages such as C or C++. LabVIEW is a proven and powerful integrated development environment to interact with measurement and control hardware, analyze data, publish results, and distribute systems. This hands-on tutorial guide helps you harness the power of LabVIEW for data acquisition. This book begins with a quick introduction to LabVIEW, running through the fundamentals of communication and data collection. Then get to grips with the auto-code generation feature of LabVIEW using its GUI interface. You will learn how to use NI-DAQmax Data acquisition VIs, showing how LabVIEW can be used to appropriate a true physical phenomenon (such as temperature, light, and so on) and convert it to an appropriate data type that can be manipulated and analyzed with a computer. You will also learn how to create Distribution Kit for LabVIEW, acquainting yourself with various debugging techniques offered by LabVIEW to help you in situations where bugs are not letting you run your programs as intended. By the end of the book, you will have a clear idea how to build your own data acquisition system independently and much more.
Table of Contents (18 chapters)
Data Acquisition Using LabVIEW
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
9
Alternate Software for DAQ

LabVIEW menu bar icons


A few words about menu bar icons are necessary. Note that actual menus and submenus do the main work and one must be familiarized with the functionality of many menus and their subsequent submenus and panels. The following are the absolutely necessary items a user must be familiar with to begin work in LabVIEW.

  • The Run button will commence execution of a VI given that a minimum of code is provided at least in the Block Diagram window. A few points must be noted:

    • A program may have enough code and this button may be pressed but there may not be anything obvious or present in any of the open windows

    • A program or a VI may run perfectly fine and extremely fast, as fast as the speed of the computer that LabVIEW is running on (given all operating system delays, background programs and processes, and so on) without anything noticeable to the human eye. Care must be taken to spot insert alerts, delays, or indicators if needs be.

  • When a program is successfully running (independent of the actual intended objective of the VI) these four Icons change shape from their idle state appearance. Note that there may be unintentional loops that will appear as "successful running program to LabVIEW" such as a while loop that does not have correct exit condition(s), typically called an endless loop. In such a case (where even milliseconds of delay is not implemented), LabVIEW would get hold of all processors on the computer and may lock the computer such that no buttons on LabVIEW or, for that matter, even keyboard and mouse clicks would be effective. In these cases, depending on the operating system in use, a user may have to temporarily shut down the computer to be able to escape from the locked-up situation. LabVIEW precompiles as objects are placed on the programming windows; this is an important fact that a user must keep in mind and although it is an obvious benefit, it may unintentionally work against the user if proper care is not taken while designing and implementing a project.

  • The broken link error changes the shape of the Run button. The Run button will change shape to this form if:

    • Not enough inputs and/or outputs are correctly wired

    • There are connections errors

    • An unwired object is placed in any of the two main windows of a VI

  • The Run continuously state is shown as follows.

  • The Run continuously (active) button (two looping arrows) will execute a VI over and over even though the actual VI logic has not provisioned to run more than once. Used with caution, this button is a good way of running/testing a code segment (such as a subVI) which may be planned to be incorporated in a looped project.

  • The Stop button.

  • The Pause button.

  • The highlight execution button may be the quickest and the most useful way of debugging or simply viewing the actual sequence of execution of each object and the value carried by a wire or output of a function. When evoked prior to clicking the Run button, LabVIEW slows down the execution of program such that a moving dot, and most likely several moving dots on different wires, on the currently executing wire is traceable by human eye and speed.

  • Debug tools, start single stepping(s) and step out.

  • Arrange tools. LabVIEW is graphical programming environment (although scripts may be used inside a few functions) and, as such, proper arranging of graphical representation of each object is essential to a readable and manageable source code. These buttons are very helpful in arranging and aligning groups of objects.

  • There are many occasions that an object must move to the back or to the front of a layered segment; the Reorder button arranges buttons with respect to layers rather than the position of an object in a given layer. Mostly used in the decorative aspect of a Front Panel window.

  • Any VI is created by manually placing an object onto its respective window and probably resizing it (such as a for loop or a while loop) and all objects need to be manually wired. Even on a simple VI, this  process may get overwhelmingly complicated and it is very hard to trace each wire from where it starts to where it ends. Clean Up can actually help to automatically rearrange a complete VI or a selected segment of the code. However, save the code before applying automatic Clean Up to your code since there exist situations where a Clean Up may make the Block Diagram prettier but may also cause the code to be harder to read and/or add or remove any of its objects. With little experience and continuous and periodic applications of Clean Up, this could become a very useful tool.

  • Activating the Help button and hovering over any object will automatically open a window with very helpful information about that object, related documents, and even links to examples and usage information.

  • The Connector pane icon object is used to connect wires to input of this subVI and/or have access to its output(s) if either case does exist.

  • Icon editing tool, by default, any new VI has this icon and only the subsequent numbers on the bottom right of the icon are enumerated. By clicking on this tool, an Icon editor subprogram is launched where users can create and edit their own icons or import previously created icons.

  • When a VI is created, the actual file is represented by this icon, which can also be modified by an editor.