labview handson manual
Post on 02-Nov-2014
94 Views
Preview:
TRANSCRIPT
Introduction to LabVIEW™
Graphical Programming
Hands-On Seminar
Customer Manual
August 2010 Edition
Northern Region
Copyright
© 2010 National Instruments Corporation. All rights reserved. Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation.
National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by
copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to
others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable
license or other legal restriction.
Trademarks National Instruments, NI, ni.com, and LabVIEW are trademarks of National Instruments Corporation. Refer to the Terms of Use section
on ni.com/legal for more information about National Instruments trademarks.
Product and company names mentioned herein are trademarks or trade names of their respective companies.
Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency partnership, or joint-venture relationship with National Instruments.
Patents
For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software, the
patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents.
LabVIEW Graphical Programming Hands-On Seminar iii ni.com
Worldwide Technical Support and Product Information ni.com
National Instruments Corporate Headquarters 11500 North Mopac Expressway, Austin, Texas 78759-3504 USA Tel: 512 683 0100
Worldwide Offices Australia 1800 300 800, Austria 43 0 662 457990-0, Belgium 32 (0) 2 757 00 20, Brazil 55 11 3262 3599,
Canada 800 433 3488, China 86 21 5050 9800, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00,
Finland 358 (0) 9 725 72511, France 01 57 66 24 24, Germany 49 89 7413130, India 91 80 41190000, Israel 972 3 6393737,
Italy 39 02 41309277, Japan 0120-527196, Korea 82 02 3451 3400, Lebanon 961 0 1 33 28 28, Malaysia 1800 887710,
Mexico 01 800 010 0793, Netherlands 31 (0) 348 433 466, New Zealand 0800 553 322, Norway 47 (0) 66 90 76 60,
Poland 48 22 3390150, Portugal 351 210 311 210, Russia 7 495 783 6851, Singapore 1800 226 5886,
Slovenia 386 3 425 42 00, South Africa 27 0 11 805 8197, Spain 34 91 640 0085, Sweden 46 (0) 8 587 895 00,
Switzerland 41 56 2005151, Taiwan 886 02 2377 2222, Thailand 662 278 6777, Turkey 90 212 279 3031,
United Kingdom 44 0 1635 523545
LabVIEW Graphical Programming Hands-On Seminar iv ni.com
Contents
National Instruments Overview ..................................................................................................................... 1
Exercise #1: Open and Run Final Application...................................................................................... 15
Exercise #2: Simulate Signal to Graph ................................................................................................. 28
Exercise #3: Taking a Basic Measurement ........................................................................................... 43
Exercise #4: Add Analysis and Output ................................................................................................. 57
Exercise #5: Write to File ..................................................................................................................... 67
Next Steps ................................................................................................................................................... 70
LabVIEW Modules and Toolkits ................................................................................................................ 77
LabVIEW Graphical Programming Hands-On Seminar 1 ni.com
1
Welcome to the Introduction to LabVIEW Graphical Programming Hands-
On Seminar. This seminar introduces you to building measurement and automation applications using graphical development. Through hands-on
exercises, you learn the concept of graphical programming and how you can use it to build powerful instrumentation and data acquisition systems.
In some exercises, you will build LabVIEW virtual instruments (VIs). In other exercises, you will run completed LabVIEW VIs. All of the examples
demonstrate the power and flexibility of the LabVIEW graphical development paradigm.
By the end of this seminar, you will learn that no matter what
measurement you need to make, LabVIEW provides a solution.
LabVIEW Graphical Programming Hands-On Seminar 2 ni.com
2
What You’ll Do Today
• Learn LabVIEW fundamentals
• Acquire temperature signal
• Output warning light based on alarm level
• Write data to file
During today‟s seminar you will learn the basics of the LabVIEW environment and create a data acquisition application that does the
following:
• Acquires a temperature signal • Determines if the temperature is above a chosen level
• Outputs a warning to the screen and a digital output to the hardware • Writes acquired data to file
In addition to those basic exercises we will review several case studies of
companies that have used LabVIEW and National Instruments hardware to build advanced applications. For more examples of how engineers and
scientists have used our products please visit http://www.ni.com/solutions.
Finally, information regarding modules and toolkits that increase
LabVIEW‟s functionality in different industries can be found in the appendices.
LabVIEW Graphical Programming Hands-On Seminar 3 ni.com
3
• Leaders in Computer-Based Measurement and Automation
• Long-term Track Record of Growth and Profitability
• Fortune’s “100 Best Companies to Work For” 11 years in a row
• Significant investment in research and development > 18% of revenue in 2009
• More than 5000 employees; operations in more than 40 countries
• LabVIEW 1.0 released in 1986
National Instruments at a Glance
National Instruments transforms the way engineers and scientists around the world design, prototype, and deploy systems for test, control, and
embedded design applications. Using NI open graphical programming
software and modular hardware, customers at more than 25,000 companies annually simplify development, increase productivity, and
dramatically reduce time to market. From testing next-generation gaming systems to creating breakthrough medical devices, NI customers
continuously develop innovative technologies that impact millions of people.
Over the last 20 years LabVIEW has earned a strong reputation as the
software tool for creating measurement solutions. LabVIEW users have an advantage of traditional text based programmers by reducing
development time, and taking advantage of functionality that is pre-built for test and control applications. This enables users to reduce
development time by up to 40% and easily create complex data acquisition and control applications which previously required extensive
knowledge of software design.
LabVIEW Graphical Programming Hands-On Seminar 4 ni.com
4
Virtual Instrumentation with LabVIEW
Automated Test
Industrial
Embedded
Software-defined behavior
Modular I/O
In the past, vendor-defined instruments were necessary for data acquisition systems. Those instruments were limited to the functionality
designed into them by the manufacturer, eliminating the ability to
customize them for a specific solution and requiring extra time and equipment to incorporate them into larger systems. When LabVIEW
launched in 1986, National Instruments introduced a new concept for data acquisition: virtual instrumentation.
Virtual instrumentation involves designing your application on standard
desktop PCs and then deploying it to whatever hardware platform your application requires, including desktop, automated test, industrial and
embedded devices. This method allows developers to use flexible, off-the-shelf hardware to create custom acquisition and control systems. It also
speeds up the overall development time of your system since there‟s no need for custom equipment or learning multiple programming languages
for each hardware platform you use.
Virtual Instrumentation is possible because of LabVIEW. LabVIEW is a
graphical programming language that allows scientists and engineers to program their own applications with its easy-to-learn environment.
LabVIEW works seamlessly with NI hardware and contains over 6000 instrument drivers to connect with your existing hardware.
LabVIEW Graphical Programming Hands-On Seminar 5 ni.com
6
What is LabVIEW?
LabVIEW is designed to help you solve technical challenges you face daily.
Regardless of what industry you are in, LabVIEW has built in functions for common tasks such as data acquisition and analysis, to more specialized
functions for applications such as control design, simulation, or RF design.
For those with a programming background, you will find all the programming constructs you relay on such as case statements, For and
While loops, etc., as well as a wide array of ready to use functions including string parsing, file i/o, and array manipulations.
You do not need to be a programmer to use LabVIEW, there are features designed for both the non-programmer and for those who have extensive
application development background. For the non-programmer LabVIEW offers Express VIs which are interactive, configuration oriented functions
which you parameterize and connect together to perform tasks such as data acquisition, analysis and reporting.
Regardless of your programming experience LabVIEW has thousands of
built-in analysis functions, and a wide array of toolkits and modules that offer specific functionality in areas such as real-time control, RF design,
SCADA application development, motion control and machine vision, to name just a few.
LabVIEW Graphical Programming Hands-On Seminar 6 ni.com
7
GProgramming
Language
Hardware SupportAnalysis and
Technical Code Libraries
Reporting and Data Visualization Tools
Technology Abstraction
Models of Computation
LabVIEW is a highly productive development environment for creating custom applications that interact with real-world data or signals in fields
such as science and engineering.
LabVIEW itself is a software development environment that contains
numerous components, several of which are required for any type of test, measurement, or control application. Each component is designed in
some way to save you time or otherwise make you more productive by eliminating unnecessary details or making difficult operations easier.
To quote one of our software developers, “We write low level code so you
don‟t have to.” Our team of developers continually trying free LabVIEW users up to focus on the bigger problems and tasks they are trying to
solve.
Some people need every component. Others only use some parts. However, everyone who uses LabVIEW is aware of the productivity and
empowerment that comes from abstracting unnecessary complexity and
being able to focus on the challenge at hand, not the challenges typically associated with creating custom software.
LabVIEW Graphical Programming Hands-On Seminar 7 ni.com
8
LabVIEW is a Programming Language• Graphical Programming
• Data types
• Structures (i.e. loops, case, event handling)
• Standard functions (i.e. File I/O)
• Reuse external code
• Compiles to machine code
• Automatic multithreading
LabVIEW is a graphical programming language. Like text-based languages, LabVIEW has common programming devices like data types
(numbers, strings, arrays, etc.), structures (for loops, while loops, case
structures, event handling) and functions (file I/O, comparisons, etc.).
Graphical programming is valuable for domain experts that don‟t have a heavy background in text-based programming. Using function blocks,
wires and loops in place of text strings, engineers and scientists can create a program that looks similar to their whiteboard drawings of an
application instead of translating that high level design to specific text strings, avoiding errors in that translation from algorithm to code. This
additional level of abstraction aides in program design, but in no way decreases application power. Like text-based languages, LabVIEW
compiles to machine code when run and performs at similar speeds to applications written in text-based languages. In addition to including its
own, optimized compiler for run-time, LabVIEW continually compiles your program during design to help you catch errors while you code.
Multicore processing is one of the most important trends in computing today, and LabVIEW has been inherently multithreaded for over 10 years.
LabVIEW automatically looks for ways to break up your application into different pieces that can be processed simultaneously on multiple cores.
That way, without any effort on your part, your applications can see improved execution speeds.
LabVIEW Graphical Programming Hands-On Seminar 8 ni.com
9
LabVIEW is a Development Environment• Debugging tools
• Assistants
• Configurable functions
• I/O Finder
• Easy UI Development
• Software Engineering Tools
• Performance Tools
Beyond being a graphical programming language, LabVIEW provides an entire development environment that makes the process of application
development faster and easier than standard development languages.
Debugging tools – As mentioned previously, LabVIEW continually
compiles your code as you develop to help you identify and correct issues as they occur. Beyond that, LabVIEW also has built in utilities that track
how different pieces of your code interact and what dependencies exist.
Assistants – From setting up hardware to designing customer filters for signal processing applications, LabVIEW has dozens of wizards and
assistants to help you create custom applications with standard, easy-to-use tools.
Configurable functions – LabVIEW has thousands of pre-made functions
that you can use to build larger applications. Each of these functions can be customized even further to meet you own unique needs.
I/O Finder – LabVIEW has built-in wizards that help you automatically detect and set up hardware for your application. We will use several of
these wizards to set up hardware for input and output in today‟s exercises.
Easy UI Development – You can make user interfaces without any
programming experience, and they can be as simple or complex as your application requires. Drag-and-drop UI elements like graphs, knobs,
LabVIEW Graphical Programming Hands-On Seminar 9 ni.com
displays and decorations require no programming beyond visually
connecting them to the rest of your application (we will do this in today‟s exercises).
Software Engineering Tools – LabVIEW has the tools you will need as your applications become more complex, and more than one developer
works on a single application. Manage your code base with the LabVIEW Project Explorer and integrate with the source code control applications.
Map graphical code in LabVIEW to requirements documents and distribute professional, end-use applications with LabVIEW Application Builder.
Performance Tools – After you have created your program, use tools
like VI Analyzer and VI Profiler to optimize your codes appearance and behavior.
LabVIEW Graphical Programming Hands-On Seminar 10 ni.com
10
LabVIEW Has Built-in Engineering Libraries• In-line and off-line analysis and control
• Signal processing
• Analysis and filtering
• Complex math
• PID
• Vision
• Motion
LabVIEW includes hundreds of analysis functions in areas including signal processing, filter design, math, PID, and vision and motion control. Using
these libraries in the same application where you acquire measurements
simplifies data acquisition application development and allows you to do more in a single environment. You can also bring in previously acquired
data for analysis.
LabVIEW Graphical Programming Hands-On Seminar 11 ni.com
11
LabVIEW Easily Connects to Hardware I/O• 8000+ instruments from over 250 vendors
• PCI, PCIe, PXI, USB, Ethernet, serial, GPIB, and
CAN devices
• Modular data acquisition hardware from DC to
the GHz range
• Motion control stages
• Cameras
• Hundreds of PLCs
What makes LabVIEW the superior choice for acquisition and control applications is its ability to integrate with hardware to acquire real-world
data. LabVIEW delivers seamless connectivity with a wide range of
measurement hardware. You can use LabVIEW to quickly configure and use almost any measurement device, from stand-alone instruments to
USB data acquisition devices, motion controllers, image acquisition systems, and programmable logic controllers (PLCs).
If you use bench top instruments such as an Agilent Network Analyzer, or
other standalone instruments to make measurements, there are over 6,000 instrument drivers from over 250 instrument providers available
online that enable you to control these instruments from LabVIEW. You are also opening yourself to use a wide range National Instruments hardware
products allow you to create solutions including rugged industrial monitoring applications, bench top data acquisition, Real-Time process
control, prototyping embedded control systems, and handheld applications running on a PDA to name just a few.
Given the time constraints of today‟s seminar we are going to focus on how to acquire, analyze and present data using LabVIEW. However it‟s
important to recognize that the capabilities of LabVIEW extend far beyond simple data acquisition to include areas such as PID control, vision
inspection, Embedded design, rapid prototyping and so on.
LabVIEW Graphical Programming Hands-On Seminar 12 ni.com
12
LabVIEW Fundamentals
LabVIEW Graphical Programming Hands-On Seminar 13 ni.com
13
The LabVIEW Environment“VI” = program or function
“Front Panel” = user interface “Block Diagram” = code
A LabVIEW program, also referred to as a VI (virtual instrument), consists of two windows: the front panel and the block diagram. The front panel is
where you create the user interface for your VI. The block diagram is the brain of your VI – it is the home for your code. A complete block diagram
has a similar appearance to a flowchart. The following pages will provide more detail on how to add and edit objects in both windows.
You can arrange the front panel and block diagram to stand side-by-side
by pressing <ctrl + T>. It is important to note that adding an object to the front panel creates an associated terminal on the block diagram that
allows for functions to be performed on the inputs (“controls”) and then be
routed to the appropriate output (“indicator”).
Larger applications are made by adding lower level VIs to a main VI. VIs that are part of another application are referred to as “subVIs.” For
example, you might create several VIs that perform different signal analysis and then use them as function blocks in your overall application.
LabVIEW Graphical Programming Hands-On Seminar 14 ni.com
14
Exercise: Open and Run Final Application
• Explore final application• Acquire, analyze and display temperature signal
LabVIEW Graphical Programming Hands-On Seminar 15 ni.com
Exercise 1: Open and Run Today’s Final LabVIEW Application
Today’s exercises revolve around creating a temperature monitoring application that will write the
acquired data to file and output a digital warning signal if the temperature goes above an adjustable
warning level.
This exercise gives you a chance to see what you’ll complete by today’s final application. You’ll also
explore important elements of the LabVIEW environment.
1. If you have not already done so, launch LabVIEW. Click the LabVIEW icon on your quick launch toolbar, or click Start » Programs» National Instruments» LabVIEW 2010.
Once you launch LabVIEW, the Getting Started window appears:
The LabVIEW Getting Started window appears each time you launch LabVIEW to assist you in
creating new applications or opening existing applications. Additionally you can use links on the
Getting Started window to find local and online help resources or open example programs to aid in
application design.
LabVIEW Graphical Programming Hands-On Seminar 16 ni.com
2. Open the “Intro to LabVIEW-DAQ Hands-on.lvproj” Project in the Open section of the Getting
Started window or navigate to it by pressing “Browse…” link and going to the LabVIEW
Handson folder on the desktop. Once opened, the “Intro to LabVIEW-DAQ Hands-on” Project
Explorer looks like this:
The Project Explorer provides a central location for you to include the different elements of an
application including LabVIEW code and other files like Microsoft Word and Excel documents. You
can include any file in a LabVIEW application. You can create folders and sub-folders to organize the
files in an application. Here, a few folders have been created as part of the example.
3. Expand the “Solutions” folder in the Project Explorer and open the “5-Write to File
(Solution).vi” by double-clicking on it or right-clicking and selecting “Open.”. Every LabVIEW
application is made of a front panel and a block diagram. The front panel is the user
interface, whereas the block diagram contains the code that controls the functionality of
your application. You can toggle between the two windows by selecting Window» Show
Block Diagram or Window» Show Front Panel to see the other window. You can also switch
between the windows by pressing <Ctrl-E> on the keyboard or clicking either window if both
are present on your monitor.
LabVIEW Graphical Programming Hands-On Seminar 17 ni.com
Hover the cursor over the different objects on the front panel. Notice that your cursor turns to a
pointer finger when above the Stop button, and turns into a text editor when above a text field. By
default, LabVIEW’s Automatic Tool Selection will change the cursor depending on what operations
are possible. Also notice that as you move over any object, resizing boxes appear on its edges. Try
resizing a few objects’ sizes.
4. Notice the menu bar at the top of the window. We will discuss many of its basic items in
future pages and exercises. For now, the most important button to review is the “Run”
button, found on the left edge of the menu bar.
You must press the Run button to begin any LabVIEW application, and a broken run arrow tells you
that there are some unresolved errors in the code. Since LabVIEW is continually compiling code
throughout development, you can press the broken Run button at any time and a list of current
errors will appear.
5. Make sure that your CompactDAQ chassis is powered on, that it’s connected to your PC with
a USB cable and that the I/O modules are plugged in firmly to the chassis. Now press the Run
button in the LabVIEW application and watch as the application begins to record
LabVIEW Graphical Programming Hands-On Seminar 18 ni.com
temperature data from the module plugged into the first slot of the CompactDAQ chassis.
Contact the instructor if your application isn’t running as described.
Hold the end of the thermocouple and watch the values on the graph rise and fall accordingly.
Change the “Alarm Level” control to different values and hold the thermocouple so that it rises
above and below the value you’ve entered on the front panel.
As temperature rises and falls around the Alarm Level, look at the NI 9472 module in the
CompactDAQ chassis. One digital output line on this module has been programmed to drive a 5V
signal whenever temperature is greater than the value of Alarm Level. The module’s LEDs indicate
the status of each digital line. These lines could be connected to other hardware, like a light or
buzzer, or other 5V devices.
6. Press the Stop button on the front panel once you are ready to move on.
Navigate to the block diagram.
LabVIEW’s graphical programming makes application execution intuitive. In this case our application
does the following:
1. Acquires temperature data with the DAQ Assistant and displays it on a chart
2. Compares acquired data with Alarm Level
3. Outputs 0V or 5V to the digital output module based on the comparison in #2
4. Writes acquired data to file.
7. Distribute the front panel and block diagram windows so that both are visible in your
monitor. Once created, navigate to Window» Tile Left and Right to tile the front panel and
block diagram on your monitor, or press <Ctrl + T>.
LabVIEW Graphical Programming Hands-On Seminar 19 ni.com
Notice that for every object on the front panel, there is a terminal with the same name on the block
diagram. The functions and wires on the block diagram connect the inputs (“controls”) and outputs
(“indicators”) on the front panel. As you add objects to the front panel in future exercises you’ll see
that terminals are automatically created on the block diagram.
Additional Steps
8. The LabVIEW help system is a great way to learn about LabVIEW and answer your programming questions. Press <F1> on the keyboard to start the help system. More assistance can be found from the LabVIEW» Help menu.
9. Expand Fundamentals» LabVIEW Environment and explore the information available here, click around and get a feel for how it is organized.
10. Take a few minutes to explore other topics in the help system.
11. Click on the Search tab and try searching on analysis functions for features you might need in your applications.
End of Exercise 1
LabVIEW Graphical Programming Hands-On Seminar 20 ni.com
15
Controls & Indicators
• Knobs/Dials
• Graphs/Charts
• Buttons
• Digital Displays
• Sliders
• Thermometers
• Customize and create your own
The LabVIEW front panel includes over 300 controls and indicators designed specifically for measurement applications. Each object is
configurable, enabling you to create professional graphical interfaces. A control is a front panel object for user input. Simple examples of controls
include buttons, slides, dials, and text boxes. An indicator is a front panel object that displays data to the user. Examples of indicators are graphs,
thermometers, and gauges. When you place a control or indicator on the front panel, a corresponding terminal is placed on the block diagram.
LabVIEW Graphical Programming Hands-On Seminar 21 ni.com
16
Finding Front Panel Objects
or
• Right-click on Front Panel• Browse by object hierarchy
• Press <ctrl + space> to bring up• Search by object name
Controls PaletteControls Quick Drop
Build a front panel by dragging and dropping controls and indicators from the Controls palette. Similar objects are divided into subpalettes for
easier navigation. Right click on any open space on the front panel to bring up the Controls palette, and navigate through the palettes by
hovering over the category icon of object you want to add. Left-click on an object in the palette and it will be placed on your cursor. Move the
object to the desired location and left-click to drop it onto the front panel. Once placed you can move or resize the object, or right-click on the object
to adjust other properties.
To access front panel objects by name, press <ctrl + Space> while the
front panel is active and the Quick Drop dialog will appear. Search for objects using any part of its name and a list of possible choices will appear
below. Double click on the name of the object you want it will be placed on your cursor for use on your front panel.
LabVIEW Graphical Programming Hands-On Seminar 22 ni.com
17
Functions and Express VIs
Configuration BasedExpress VI
Standard VIs
We will now move to the block diagram window, where you will create the VI‟s functionality. Individual functions, or subVIs, are wired together to
create your application logic. Functions can be broken into two types: standard VIs and Express VIs. Both types of VIs can work together in an
application and both serve unique use cases.
Standard VIs are low level building blocks for an application. Each VI performs a particular function and will output based on the inputs
provided. We will discuss how subVIs communicate on the following page. Standard VIs provide a way to create customized functionality and
execution control. For today‟s exercises we‟ll use Express VIs, which are a
great way to learn LabVIEW, as well as make basic applications. As your applications get more complex you will begin to use the standard VIs
more and more.
Express VIs are designed to streamline your application development. There are over 40 Express VIs included in LabVIEW that enable you to
create complete measurement programs in seconds. These VIs were created for the most frequently built applications with your productivity
and efficiency needs in mind. The power you have with Express VIs is found in the configuration pages for each that you can individually
customize simply by double-clicking them. This will significantly reduce the number of objects on your block diagram and the time needed to add
additional functionality.
LabVIEW Graphical Programming Hands-On Seminar 23 ni.com
18
Dataflow Programming
1
2
3
Comparison waits until all inputs are present, then executes
Once executed, output from comparison continues through code
Both Simulate Signal Express VIs execute simultaneously
1 2 3
LabVIEW is a dataflow programming language. This means that data flows from one function to one or more other functions and propagates through
the application. Unlike text-based development software, LabVIEW, because of its dataflow capability, is not sequential and can execute
multiple operations in parallel using its intuitive diagram representation. For example, as you can see in this slide, the two Simulate Signal Express
VIs execute in parallel.
LabVIEW is a multithreaded programming environment, meaning that multiple operations can occur simultaneously without interfering with each
other. Additionally, our redesigned NI-DAQmx data acquisition driver
software also allows you to perform multithreaded measurements. LabVIEW is a compiled graphical dataflow programming that maps
functional blocks to concepts. At the core of the LabVIEW platform is a graphical programming language called “G”. Compiled for comparable
execution to C, LabVIEW G is based on dataflow technology, particularly suited to rapidly designing systems with parallel execution of tasks. The
graphical nature of the language is typically a much more intuitive development paradigm for engineers and scientists than a text-based
solution – it mimics the flowcharts with which these users are very familiar.
The LabVIEW language abstracts a great deal of artificial complexity created by other programming tools, enabling higher productivity and
faster development for test, measurement, and control applications.
LabVIEW Graphical Programming Hands-On Seminar 24 ni.com
19
• LabVIEW automatically divides each application into multiple
execution threads (introduced in 1998 with LabVIEW 5.0)
• Parallel code paths will execute in unique threads
Automatic Multithreading in LabVIEW
thread
thread
thread
•For 20 years, we‟ve been working on LabVIEW graphical programming and dataflow, which are inherently parallel
•We‟ve been working on multithreading in LabVIEW for 10 years and have significant investment in this area.
Let‟s first review what the LV compiler does for you behind the scenes. LV
automatically divides your program into two threads – a user interface thread and an execution thread – to separate the two fundamental parts
of a program that can bog down your application. Because updating the UI can be time-consuming, or because the UI could become sluggish or
non-responsive when it is bogged down by procesor-intensive processing
– LV Vis are automatically divided into these two threads so the OS can manage your app better.
The user doesn‟t have to know anything about threads to take advantage
of multicore processing and get better performance.
LabVIEW Graphical Programming Hands-On Seminar 25 ni.com
21
Wires and Data Types
• Transfer data between block diagram objects through wires
• Wires are different colors, styles, and thicknesses, depending on their data types
• A broken wire appears as a dashed black line with a red X in the middle
21
Scalar1D Array2D Array
DBL Numeric Integer Numeric String
Data is passed between functions on the Block Diagram by wires. Wires represent different data types, and both color and wire thickness are used
to help differentiate the type of data a wire carries. A single wire can serve as an input for multiple functions across and application. Wires will
appear broken if you connect a wire of one type to a function input of another type. The LabVIEW compiler processes each action you take
while you code and alerts you of any errors with a broken run arrow. You can press the broken run arrow at any time to display a list of errors.
Double click on any error and its location in your application will be highlighted.
LabVIEW Graphical Programming Hands-On Seminar 26 ni.com
22
Execution Control Structures
While Loop For Loop
Run until stop condition met Run N times
• Allow same piece of code to run multiple times• Exit conditions different for each
Use While or For loops to enable sections of your LabVIEW code to run repeatedly. A While loop will continue to execute until a stop condition is
specified. The stop condition can be a simple button press, or a series of specific logical conditions. The For loop will execute a predetermined
number of times as specified by the number of iterations you wire to the N input. You may also connect an array wire to the edge of a for loop and
leave the N input unwired. The For loop‟s number of iterations will be determined by the array size that is wired at its edge. This is called Auto
indexing.
To find the While and For loops, as well as other control structures, left-
click on any empty space on the block diagram and navigate to Programming>>Structures.
LabVIEW Graphical Programming Hands-On Seminar 27 ni.com
26
Exercise 2: Simulate Signal to Graph
• Simulate various signals• Write to Graph
LabVIEW Graphical Programming Hands-On Seminar 28 ni.com
Exercise 2: Simulate a Signal and Output to a Chart
This exercise will review the LabVIEW environment basics you have learned so far. You will create an
application that simulates a signal inside of LabVIEW and display that signal to a chart.
1. Open a blank VI from the Intro to LabVIEW-DAQ Hands-on Project Explorer by right-clicking
the “Exercises” folder and selecting New» VI.
2. Save this VI by selecting File>>Save and name it “2-Simulate Signal to Graph.vi”
3. Add a While Loop to the block diagram. Right-click on any empty space on the block diagram
to bring up the Functions palette, and then navigate to Programming» Structures» While
Loop. Left-click the While loop and it will be automatically placed on your cursor.
LabVIEW Graphical Programming Hands-On Seminar 29 ni.com
Click and then drag diagonally to form the While loop to the area you desire. You can resize the
While loop by dragging any of the resizing boxes that appear when your cursor hovers above the
loop’s edges.
4. You can also create a While loop by pressing <Ctrl + Space Bar> to bring up the Quick Drop
dialog. Begin typing “While Loop” and it will appear in the list of possible objects. Double-
click its name and it will appear on your cursor for use on the block diagram. Since you’ve
already placed the while loop, release the while loop you found using Quick Drop by right-
clicking.
5. While loops have two terminals in their bottom left and right corners.
LabVIEW Graphical Programming Hands-On Seminar 30 ni.com
The most important of the two is the loop condition . The conditional terminal is on the lower
right side. Since while loops run until told to stop, we must provide some kind of stop command so
that the loop won’t run indefinitely. Notice the broken run arrow in the upper left of the screen.
LabVIEW cannot execute an application that contains a while loop with an un-wired conditional
terminal. For our application, we need to create a stop button that the user will press to halt the
while loop and exit the program.
6. On the front panel, right click on any empty space to bring up the Controls palette and
navigate to Modern» Boolean» Stop Button. Left click on the stop button and it will be
automatically placed on your cursor.
LabVIEW Graphical Programming Hands-On Seminar 31 ni.com
Left-click where you would like to place it on the front panel. Enlarge the Stop button by moving your
cursor to one of the button’s edges and dragging the resizing boxes.
7. Look again at the block diagram. Notice that a terminal for the stop button has appeared.
This terminal acts as the connector from the front panel to the functionality of the block
diagram. Click the stop terminal and drag it next to the loop condition terminal in the While
loop.
8. Move your cursor to the right edge of the stop terminal and notice that the edge of the
terminal is blinking and the cursor now looks like a spool. This is the wiring tool that lets you
draw wires between different objects on the block diagram. Left-click the edge of the stop
terminal and drag the cursor until you are hovering over the left edge of the While loop’s
condition terminal, and then release. The wire is now connected between the stop terminal
and the conditional terminal.
or (both diagrams indicate the same)
With the While loop now having a way to exit, the broken Run arrow is replaced with a Run arrow
and your application is ready to run, but you’ll need to add more code to accomplish the tasks of this
exercise.
9. The other terminal in the while loop, the loop iteration counter , outputs the number of
times the While loop has iterated. That information may be useful depending on your
application, but we will not be using it today, it is not required that we do anything with it in
order to run our program.
10. Create a simulated signal. Press <Ctrl + Space Bar> to bring up the Quick Drop dialog and
begin to type “Simulate Signal.” Double-Click “Simulate Signal” once you see it in the box
below where you are typing and the Simulate Signal Express VI will automatically appear on
your cursor.
LabVIEW Graphical Programming Hands-On Seminar 32 ni.com
11. Double-click to place the Simulate Signal Express VI inside the While loop and its
configuration dialog will appear.
12. Change the Signal Type, Amplitude, Frequency, Offset and Phase values in the Signal portion
of the dialog and see the changes in the Results Preview portion. Deselect the “Use signal
type name” box in the Signal Name section and enter “Simulated Signal” as the name.
Once you have chosen the signal you want to display, press “OK.” The Simulate Signal Express VI has
now been customized based on the settings you provided.
13. Connect the simulated signal to a chart by moving to the front panel and bring up the Quick
Drop dialog and type the word “chart”. Place the Waveform Chart on the front panel at the
location you prefer.
14. Return to the block diagram and move the chart’s icon into the While loop, to the right of the
Simulate Signal Express VI. Connect the output of the Simulate Signal Express VI (“Simulated
Signal”) to the chart terminal. Notice that the chart terminal changed colors to reflect the
data type it received.
LabVIEW Graphical Programming Hands-On Seminar 33 ni.com
15. Return to the front panel and Run the VI. The simulated signal you created in the Express VI
is now displayed on the chart. Press the Stop button when you are ready to move on.
16. Add controls to adjust signal frequency and amplitude while the program is running. Right-
click on an empty space on the front panel to bring up the Controls palette, find the knob
control (Modern» Numeric» Knob) and place it on the front panel. Double-click on the
knob’s label and change it to “Amplitude.”
17. Repeat step #13 to make another knob for frequency. Change its label to Frequency. Double-
click the maximum value on Frequency’s scale and change it to 50.
Front Panel
LabVIEW Graphical Programming Hands-On Seminar 34 ni.com
Block Diagram
18. On the block diagram, move the Amplitude and Frequency controls inside of the while loop
and connect them to the associated inputs of the Simulate Signal Express VI. Once both
terminals are inside the while loop, on the left side of the Simulate Signal Express VI, hover
your cursor over the right side of each terminal until the wiring tool appears on the cursor.
Left-click and drag the connection to the identically named input on the Express VI. Your
block diagram should look like the image above.
19. Run the VI. Press the Run arrow, manipulate Amplitude and Frequency and notice the chart
display changes accordingly. The Chart’s y-axis auto-scales to maximize the signals size on the
display. To disable that feature, right click the chart and deselect “AutoScale Y.”
You can now change the upper and lower ranges of the Y-axis by clicking on the numbers along the
axis and typing in new values.
20. Stop the VI by pressing the stop button.
LabVIEW Graphical Programming Hands-On Seminar 35 ni.com
Helpful tips
LabVIEW provides several tools that can help you develop your applications. The next few steps will
show how to use some of the most important programming assistance tools.
Block Diagram Cleanup
21. Use Block Diagram Cleanup to organize your block diagram. As you program, and especially
as you learn how to program in LabVIEW, you are not always thinking about layout and
readability. This can result in a poorly organized block diagram.
LabVIEW Block Diagram Cleanup is a built-in tool that organizes your code, making it easier for you
and others to understand how your program functions. Press the Block Diagram Cleanup icon found
on the menu bar.
Your block diagram should now be organized, with cleaner wires and an even distribution of code
elements.
To customize how the Block Diagram Cleanup tool organizes your code, navigate to the Options
menu at Tools» Options… and scroll to the Block Diagram Cleanup section.
This menu lets you customize how far wires, structures, functions and terminals will be spaced from
each other and from the edges of your block diagram. Click OK when you are ready to move on.
LabVIEW Graphical Programming Hands-On Seminar 36 ni.com
Highlight Execution
22. Use Highlight Execution to observe how your application runs. Press the Highlight Execution
button on the menu bar. Notice that the light bulb icon now appears to be on.
23. Run your application with Highlight Execution turned on. Press the Run arrow and watch as
your code executes step-by-step. While not always necessary for simple applications, the
Highlight Execution tool is a powerful resource for trouble shooting complex programs and
determining if your code performs as expected.
Context Help
24. Use Context Help to identify object details while programming. Press the Context Help
button in the upper right portion of the block diagram.
25. With the Context Help active, hover your cursor over different objects on the block diagram
and front panel of Simulate Signal to Graph.vi. As you do so, the Context Help Window
provides details including descriptions and wiring diagrams.
LabVIEW Graphical Programming Hands-On Seminar 37 ni.com
26. Right-click on the block diagram and navigate around the palettes. Notice that the Context
Help window provides details on the objects while they are in the palettes. Also notice that
for some objects, the Context Help window provides a link for “Detailed Help…” This link will
open the LV Help and give you more information.
27. Save 2-Simulate Signal to Graph.vi and close.
End of Exercise #2
LabVIEW Graphical Programming Hands-On Seminar 38 ni.com
27
Built-in Programming Assistance
Highlight Execution
Block Diagram Cleanup
Context Help
Highlight Execution – Use the Highlight Execution tool to see how your code executes. This tool will slow down execution speed and allow you to
see the input and output values of the different VIs in your application and compare them to what you expect. This feature can be turned on or off
while an application runs. You can also place break points in your code so that it begins step by step processing at certain points of interest.
Block Diagram Cleanup – The Block Diagram Cleanup tool organizes
terminals and functions in an orderly way that you can customize, allowing you to spend more time on improving your application and less time
worrying about arranging objects in an orderly way. To customize the
Cleanup tool‟s algorithm go to the “Block Diagram: Cleanup” sections in the Options Menu found at Tools>>Options….
Context Help – The Context Help window provides information on any
front panel and block diagram object. Hover over any object and a brief description will appear. If available, the window will also provide a link to
more information in the LabVIEW Help (Help>>Search the LabVIEW Help…).
LabVIEW Graphical Programming Hands-On Seminar 39 ni.com
29
Data Acquisition with LabVIEW
LabVIEW Graphical Programming Hands-On Seminar 40 ni.com
31
NI DAQ Platforms
PCI / PCIe PXI / PXIe
USBWireless / Ethernet
CompactDAQModular USB
One application, multiple targets
LabVIEW uses a single driver, NI DAQmx, to integrate with all NI DAQ platforms. Your code will execute the same on different DAQ systems,
leaving channel selection and hardware bandwidth as the only variables. This means that you can distribute the same application you developed on
your desktop to various other form-factors and buses depending on your application requirements.
Note: you may want to reference the WSN modules too, although this
uses a slighlty different api.
LabVIEW Graphical Programming Hands-On Seminar 41 ni.com
32
Today’s DAQ System
Hi-Speed USB 2.0
Mix and Match over 50
modules
Hot-swappable modulesDirect sensor connectivity NI CompactDAQ
Built-in Signal Conditioning
NI CompactDAQ is a new data acquisition system that leverages USB 2.0, new semiconductor technologies, is a scalable, modular platform, and best
of all it uses the same industry standard software, NI LabVIEW and NI-DAQmx.
The convenience of USB has driven its widespread adoption. The
technology advances in USB 2.0 have introduced the performance needed for modern DAQ systems. The current specification for USB 2.0 delivers
40X the data transfer rates of its predecessor.
A modular architecture is important for a data acquisition system, because
application requirements may change over time and the same system can be used in multiple applications.
NI CompactDAQ offers many different modules and connectivity options.
Every module has integrated signal connectivity and allows you to connect your sensors directly to the module. Additionally, these modules are hot-
swappable, allowing you to plug or unplug the modules while the system is powered-on, allowing changes to the system during testing.
LabVIEW Graphical Programming Hands-On Seminar 42 ni.com
35
Exercise 3: Taking a Basic Measurement
• Acquire temperature signal• Write to graph
LabVIEW Graphical Programming Hands-On Seminar 43 ni.com
Exercise 3: Take a Basic Measurement with CompactDAQ
The purpose of this exercise is to use LabVIEW and NI CompactDAQ to quickly set up a program to
acquire temperature data.
Set up the Hardware
1. Make sure that the NI CompactDAQ chassis (cDAQ-9172 or cDAQ-9178) is powered on.
(note: actual acquisition modules used may differ slightly)
2. Connect the chassis to the PC using the USB cable.
3. The NI-DAQmx driver installed on the PC automatically detects the chassis and brings up the
following window.
4. Click Configure and Test This Device Using NI Measurement & Automation Explorer.
Note: NI Measurement & Automation Explorer is a configuration utility for all National Instruments
hardware.
5. The Devices and Interfaces section under My System shows all the National Instruments
devices installed and configured on your PC. The NI-DAQmx Devices folder shows all the NI-
LabVIEW Graphical Programming Hands-On Seminar 44 ni.com
DAQmx compatible devices. By default, the NI CompactDAQ chassis NI cDAQ-9172/9178
shows up with the name “cDAQ1”.
6. This section of MAX also shows the installed modules as well as empty slots in the
CompactDAQ chassis.
7. Right-click on NI cDAQ-9172/9178 and click on Self-Test.
8. The device passes the self test, which means it has initialized properly and is ready to be used
in your LabVIEW application.
Program LabVIEW Application
9. Create a new VI from the Project Explorer. Right click the Exercises folder and select New»
VI. Once opened, Save the VI in the Exercise folder under the name “3-Basic
Measurement.vi.”
10. Press <Ctrl +T> to tile front panel and block diagram windows.
11. Pull up the Functions Palette by right-clicking the white space on the LabVIEW block diagram
window.
12. Move your mouse over the Express» Input palette, and click the DAQ Assistant Express VI.
Left-click the empty space to place it on the block diagram.
13. The Create New Express Task… window then appears:
LabVIEW Graphical Programming Hands-On Seminar 45 ni.com
14. To configure a temperature measurement application with a thermocouple, click Acquire
Signals» DAQmx Acquire» Analog Input» Temperature» Thermocouple. Click the + sign next
to the cDAQ1Mod1 (NI 9211 or NI 9219), highlight channel ai0, and click Finish. This adds a
physical channel to your measurement task.
LabVIEW Graphical Programming Hands-On Seminar 46 ni.com
15. Change the CJC Source to Built In and Acquisition Mode to Continuous Samples. Select the
correct thermocouple type (J or K) Click the Run button. You will see the temperature
readings from the thermocouple in test panel window.
16. Click Stop and then click OK to close the Express block configuration window to return to the
LabVIEW block diagram.
17. LabVIEW automatically creates the code for this measurement task. Click Yes to
automatically create a While Loop.
18. On the front panel, right-click to bring up the controls palette and add a waveform chart
indicator (Express>>Graph Indicators>>Chart). Rename “Waveform Chart” to “Temperature”
Note: Thermocouple types can often be identified by their lead wire colors:
Type - +
J White Black
K White Green
LabVIEW Graphical Programming Hands-On Seminar 47 ni.com
19. Notice that a connection is made to the block diagram. Move the Temperature icon inside
the while loop. Wire the DAQ Assistant with the Temperature Chart.
20. Your block diagram should now look like the figure below. The while loop automatically adds
a stop button to your front panel that allows you to stop the execution of the loop.
21. Save your VI, as ‘Exercise 3.vi’. You will re-use this in exercise 4.
22. Run the VI
Additional Steps
Express VIs make creating basic applications very easy. Their configuration dialogs allow you to set
parameter and customize inputs and outputs based on your application requirements. However, to
optimize your DAQ application’s performance and allow for greater control you should use standard
DAQmx driver VIs. Right Click the block diagram and select Functions» Measurement I/O Palette»
NI-DAQmx.
23. Before you generate DAQmx code you need to remove all the code that was automatically
created by the Express VI. Right click on the while loop and select “Remove While Loop.”
Then click the Stop button control, and press the <Delete> key to remove the Stop button.
Repeat actions for any unconnected wires that may remain. You can press <Ctrl + B> to
remove all unconnected wires from a block diagram. You can leave the Temperature Chart
on the diagram.
LabVIEW Graphical Programming Hands-On Seminar 48 ni.com
24. Convert Express VI code to standard VIs. While not all Express VIs can be automatically
converted to standard VIs, the DAQ Assistant can. This will allow for greater application
control and customization. Right-click on the DAQ Assistant Express VI you created in this
exercise and select “Generate NI-DAQmx Code.”
Your block diagram should now appear something like this:
25. Move the Temperature indicator inside the while loop and connect it to the same wire the
data indicator is at. Then delete the data indicator.
As you noticed the Express VI has been replaced by four VIs. We’ll examine their functionality in the
following steps.
26. Open Context Help by clicking the Context Help icon on the upper right corner of the block
diagram. Hover your cursor over each VI and examine their descriptions and wiring diagram.
27. DAQmx Start Task.vi starts the acquisition based on the parameters it receives from the
currently untitled VI on the far left.
28. DAQmx Read.vi reads data from preconfigured FIFO memory location.
29. DAQmx Clear Task.vi stops the current acquisition and releases the resources (memory,
configured hardware clocks, etc.).
30. Double-click the untitled VI and open that VI’s block diagram (code shown below).
LabVIEW Graphical Programming Hands-On Seminar 49 ni.com
All the parameters that are wired as inputs to the different DAQmx setup VIs reflect the settings you
originally configured in the DAQ Assistant Express VI.
Note: By moving these parameter and setup VIs onto the block diagram, you can now
programmatically change their values without having to stop your application and open the Express
VI configuration dialog. This can save development time and possibly optimizing performance by
eliminating unnecessary settings depending on your application.
31. Return to the main VI and run it.
32. Close the VI, do not save any changes.
Using the LabVIEW Example Finder
The LabVIEW Example Finder provides hundreds of example application to use as reference or as the
starting point for your application.
33. Open the LabVIEW Example Finder to find DAQ examples that use DAQmx standard VIs. Go
to Help» Find Examples… to launch the LabVIEW Example Finder.
34. Browse to the DAQmx Analog Measurements folder from the Browse tab at Hardware Input
and Output» DAQmx» Analog Measurements>>Temperature and open “Acq Thermocouple
Sample.vi.”.
LabVIEW Graphical Programming Hands-On Seminar 50 ni.com
35. The following VI will then appear:
36. Set the Thermocouple type and the Physical Channel to match the CompactDAQ chassis
channel (cDAQ1Mod1/ai0) and run the application.
LabVIEW Graphical Programming Hands-On Seminar 51 ni.com
Press the Run button several times while holding and releasing the thermocouple on the
CompactDAQ chassis and observe the value change on the front panel.
37. Open the block diagram and examine the code. This VI only uses standard VIs instead of
Express VIs, which allows much more customization of inputs and run-time configuration.
Acq Thermocouple Sample.vi has no while loop to allow for continuous execution, and the
remaining steps of this exercise will focus on adding that functionality.
38. Add a While loop and Stop button to Acq Thermocouple Sample.vi. Right-click the block
diagram to bring up the Functions palette. Find the While Loop on the Programming»
Structures palette and drag a while loop over the DAQmx Read.vi. You may need to spread
the VIs across the block diagram so that there is room. You can create additional space by
holding the <Ctrl> key and dragging a box on the block diagram or front panel.
39. Right click the While Loop’s Conditional terminal and select “Create Control.” This
automatically wires a Stop button to the terminal.
LabVIEW Graphical Programming Hands-On Seminar 52 ni.com
Notice that the Stop button has appeared on the front panel.
40. Run the VI. Acq Thermocouple Sample.vi now runs continuously.
41. Stop the VI.
42. Save the customized example VI to the Project. Go to File» Save As…, select Copy»
Substitute Copy for Original and name the VI “Thermocouple Customized Example.vi.” Save
this VI in the same folder as the rest of your project files. This allows for further development
without overwriting the original LabVIEW example.
Note: Compare the modified example to the VI you build earlier in this exercise.
What are the differences? Discuss the difference with the other attendees and the instructor. What
are the benefits of the each method?
End of Exercise 3
LabVIEW Graphical Programming Hands-On Seminar 53 ni.com
36
Analysis andSignal Processing
LabVIEW Graphical Programming Hands-On Seminar 54 ni.com
37
•Signal Processing & Analysis– Waveform Generation– Waveform Conditioning– Waveform Monitoring– Waveform Measurements– Signal Generation– Signal Operations– Windows– Digital Filters– Spectral Analysis– Transforms– Point-by-Point
•Mathematics– Numeric– Elementary and Special Functions– BLAS/LAPAC-based Linear Algebra– Curve Fitting– Interpolation / Extrapolation– Probability and Statistics– Optimization– Ordinary Differential Equations– Geometry– Polynomial– Formula Parsing– 1D & 2D Evaluation– Calculus
LabVIEW Signal Processing, Analysis and Math
Often, raw data is not the only information sought after in a measurement application. LabVIEW provides more than 450 built-in comprehensive
tools designed specifically for analyzing measurements and processing signals. Incorporate LabVIEW functions into your applications in order to
perform in-line analysis and to add decision-making capabilities to your applications. Available functions include mathematics libraries, with linear
algebra functions based on the industry-standard LAPACK/BLAS algorithms, advanced signal processing tools, and measurement analysis
functions, such as FFT and power spectrum, signal generation, digital filters, and curve fitting. There are 12 Analysis Express VIs for even more
ease of use in your analysis needs. In this seminar we will not cover these
analysis functions in depth. For more information, visit ni.com/analysis. In addition, National Instruments offers a series of toolsets that extend
the analysis capabilities of LabVIEW for more specialized applications, such as sound and vibration analysis, order analysis, and digital signal
processing. By building analysis capabilities directly into your application, you eliminate the need for performing post-acquisition analysis and obtain
results quickly.
LabVIEW Full / Pro offers general-purpose signal processing, analysis, and math tools to simplify development for a broad variety of applications.
LabVIEW Graphical Programming Hands-On Seminar 55 ni.com
38
Using Analysis Functions
Configuration BasedExpress VIs
Programmatic, Low-Level VIs
Text-based MathScript Node
Like other functions in the block diagram, analysis functions are available in standard VIs and Express VIs. Standard VIs will give you greater
control over the order, inputs and execution of your application‟s analysis. Express VIs make adding analysis functionality quick and easy at the
expense of some control in your application‟s execution.
In addition to the over 600 analysis VIs in LabVIEW, there is LabVIEW MathScript, which enables you to implement your algorithms textually and
incorporate your .m files into your application. This seminar does not include further detail concerning LabVIEW MathScript. For more
information visit ni.com/mathscript.
LabVIEW Graphical Programming Hands-On Seminar 56 ni.com
40
Exercise 4: Add Analysis and Output
• Acquire temperature signal• Average and monitor• Output based on alarm value
LabVIEW Graphical Programming Hands-On Seminar 57 ni.com
Exercise 4: Add Analysis and Digital Output to the DAQ Application
Set up Hardware
1. Confirm that the CompactDAQ chassis is powered on and connected to the PC via the USB
cable. If not, or if it is not behaving as expected, repeat steps #1-8 from Exercise #3
LabVIEW Application – Compare signal to user-defined alarm
2. Exercise 4 is functionally the same as the end result of Exercise 3. You can open Exercise 3 or
Exercise 4 to match with the illustrations in this section. Open 4-Analysis and Output.vi from
the Exercises folder in the Project explorer. The VI will appear like the image below, with
additional space on the block diagram to add functionality:
3. Create an alarm that signals if acquired temperature goes above a user-defined level. Right-
click the front panel to open the Controls palette (Modern» Numeric) and place a numeric
control on the front panel.
LabVIEW Graphical Programming Hands-On Seminar 58 ni.com
4. Change the numeric control's name to "Alarm Level." Double-click the control's label and
replace the generic text with "Alarm Level"
5. Use the Comparison Express VI to compare the acquired temperature signal with the Alarm
Level control. Switch to the block diagram, right-click on an empty space and open the
Functions palette. Place the Comparison Express VI (Functions>>Express>>Arithmetic &
Comparison>>Comparison) on the block diagram, inside the while loop.
6. Once placed on the block diagram, the Comparison Express VI's configuration dialog will
appear.
LabVIEW Graphical Programming Hands-On Seminar 59 ni.com
Select "> Greater" in the Compare Condition section and "Second signal input" from the Comparison
Inputs section then click OK.
7. Connect the acquired temperature data and Alarm Level inputs to the Comparison Express
VI. Hover over the output of the DAQ Assistant until the spool icon appears on your cursor,
then left-click and drag you mouse to the Operand 1 input on the Comparison Express VI.
Perform the same hover, drag and connect to wire the Alarm Level control and the Operand
2 input on the Comparison Express VI. Your block diagram should now look like this:
8. Display the result of the Comparison Express VI on the front panel. On the front panel, right
click, open the Controls palette and add a Square LED indicator. The square LED is found at
Controls» Modern» Boolean. Resize the Square LED so that it is easier to see and rename it
"Alarm." Your front panel should look like this:
LabVIEW Graphical Programming Hands-On Seminar 60 ni.com
9. On the block diagram, wire the output of the Comparison Express VI to the input of the
Alarm indicator's terminal.
10. Run the application. Press the Run button and then change the Alarm Level control to some
level above the current acquired temperature signal. Hold the thermocouple until the
temperature exceeds the Alarm Level value. The Alarm LED turns on when the acquired
temperature signal goes above the level set on the front panel.
LabVIEW Graphical Programming Hands-On Seminar 61 ni.com
Output Alarm to CompactDAQ Chassis
11. Use another DAQ Assistant Express VI to output Alarm's status to the CompactDAQ's 9472
module. Open the Functions palette on the block diagram and find the DAQ Assistant Express
VI at Functions» Express» Output.
12. Select Generate Signals» Digital Output» Line Output from the Create New Express Task…
window.
LabVIEW Graphical Programming Hands-On Seminar 62 ni.com
13. Select the physical channel you want to use as output. Expand the + sign next to
cDAQ1Mod4 in the following window and select port0/line0, then click Finish.
14. Press OK in the DAQ Assistant window that appears, since all of its default settings are
correct for the application.
15. Create an additional wire that connects the Comparison Express VI’s Result output to the
data input on the new DAQ Assistant Express VI. A Convert from Dynamic Data function
appears automatically. LabVIEW will always try to coerce unlike data types when two nodes
are wired together. In this case, the output of the Compare Express VI is a Dynamic Data
type, and the input of the DAQ Assistant is Boolean. LabVIEW placed the Convert from
Dynamic Data node in between the two nodes so they could be connected. You can double-
click the Convert from Dynamic Data to view its configuration. Your block diagram should
now look like this:
16. Run the VI. Press the Run button. Notice that the LED bank on the CompactDAQ 9472
module turns on and off to match Alarm's value on the front panel.
17. Save and close the VI.
End of Exercise 4
LabVIEW Graphical Programming Hands-On Seminar 63 ni.com
42
Reporting and Data Visualization
LabVIEW Graphical Programming Hands-On Seminar 64 ni.com
43
Data Visualization and CommunicationVisualization
• Built-in user interface objects
• Charting and graphing capabilities
• Remote application control
Reporting and Data Storage
• File I/O functionality
• HTML reports for the Web
• Microsoft Word and Excel reports
A fundamental aspect of all programming languages is the ability to create well designed user interfaces to interact with you application. Effective
visualization and presentation of results is essential for making decisions, monitoring processes, and sharing information. LabVIEW includes a wide
array of visualization tools to display your data. Some of these tools include charting and graphing utilities, and built-in 2D and 3D visualization
tools. Attributes of your presentation such as color, font size, and graph type can be reconfigured, and you can even rotate, zoom, and pan your
graphs at runtime.
LabVIEW also contains functions for storing your data in a variety of ways.
You can write data to ASCII and binary files, publish it in standard formats such as HTML or XML, and programmatically create custom reports.
LabVIEW offers several reporting options, including documentation-generation tools, HTML reports, programmatic generation of Microsoft
Word and Excel reports, and interactive report generation with NI DIAdem.
Finally, we must consider data management and connectivity. NI DIAdem
offers data management and offline analysis for large data sets, tools such as the Database Connectivity Toolkit allow you to connect to third-party
databases, and standard File I/O to save data. LabVIEW also offers a full range of options for communications and data standards, such as TCP/IP,
BlueTooth, OPC, SQL database connectivity, and XML data formats.
LabVIEW Graphical Programming Hands-On Seminar 65 ni.com
44
LabVIEW Supported Storage Types
• ASCII
• Binary
• HTML
• XML
• LVM
• TDM(S) *
• Excel
• Word
• Datalog
• Databases
A main part of your applications will include saving data to disk for later analysis and reporting. You have several choices in LabVIEW to save data
in a variety of different formats. If you do not want to worry about the details of saving your data, LabVIEW has several options to save data in
industry standard formats that are portable to applications such as Excel. If you do need to conform to a particular data format standard, LabVIEW
offers all the low level file I/O functions you need to write data out exactly as you need it.
File I/O can be a major pain point for companies, especially when multiple
people need to share data. To help solve these challenges NI developed a
file format called TDM. TDM is designed to help you make your “data search” ready. To see how you can benefit from TDM, see the additional
information included in this manual‟s appendix.
LabVIEW Graphical Programming Hands-On Seminar 66 ni.com
46
Exercise 5: Write to File
• Acquire temperature signal• Average and monitor• Output based on alarm value• Write to File
LabVIEW Graphical Programming Hands-On Seminar 67 ni.com
Exercise 5: Writing Data to File with LabVIEW
1. In the Exercise folder in the Project Explorer, open 4-Analysis and Output.vi. We will use the
final program from the last exercise as the beginning of this exercise.
2. Right-click the block diagram and select Functions» Express» Output» Write to
Measurement File and place it inside the While Loop on the block diagram.
3. A configuration window will appear. Configure the window as shown below, note the file
location in the “File Name” window, and click OK.
LabVIEW Graphical Programming Hands-On Seminar 68 ni.com
4. Wire the output of the DAQ Assistant Express VI to the input of the Write to Measurement
File Express VI.
5. Your block diagram should now resemble the following figure.
6. Save the VI in the project folder by using the File» Save As… menu, select the Copy» Open
Additional Copy and name it “5-Write to File.vi”.
7. Run the VI momentarily and press Stop to stop the VI.
8. Your file will be created in the folder specified.
LabVIEW Graphical Programming Hands-On Seminar 69 ni.com
9. Open the file using Microsoft Office Excel or Notepad. Review the header and temperature
data saved in the file.
10. Close the data file and the LabVIEW VI.
End of Exercise
LabVIEW Graphical Programming Hands-On Seminar 70 ni.com
48
Next Steps
LabVIEW Graphical Programming Hands-On Seminar 71 ni.com
49
Worldwide LabVIEW User Community• Over 100,000 members on award-
winning NI Discussion Forums
• NI and LabVIEW user-contributed
blogs
• More than 100 LabVIEW User
Groups
• Third-party community web sites in
over 15 languages
• Hundreds of third-party add-on
tools on the LabVIEW Tools Network
When you buy a copy of LabVIEW, you‟re also joining a worldwide community of users who work together every day to make one another
more successful. The NI Discussion Forums currently have more than 50,000 members who are answering each other‟s questions and sharing
best practices. This is an invaluable resource when you are getting started with LabVIEW and also provides an excellent place to work with experts as
you become more familiar with the LabVIEW environment.
There are also more than 100 LabVIEW User Groups located around the world. These groups of LabVIEW users meet regularly to share their
LabVIEW expertise and help their local community of users to improve
their skills. This is a very active community who work together to share presentations and best practices for helping their User Groups succeed. To
locate a User Group near you, visit LabVIEW Zone for a list of all LabVIEW User Groups.
As mentioned earlier, many third-party organizations develop LabVIEW toolkits. Quite often, these toolkits are available from individuals who
solved a particular application and want to share their expertise with the entire LabVIEW Community. For a complete listing of available LabVIEW
add-ons, visit ni.com/labviewtools. Finally, there are literally thousands of example program, tutorials, and
application notes available from LabVIEW Zone. LabVIEW Zone is your portal to the LabVIEW Community and gets you in touch with the
worldwide community of users. If you are just starting to use LabVIEW, you will find very helpful tutorials and application notes to help you get
started. As you continue to develop your skills, LabVIEW Zone can get you
in touch with other users of your skill level.
LabVIEW Graphical Programming Hands-On Seminar 72 ni.com
51
Learn More about NI LabVIEW and NI DAQ Systems
• Check out additional LabVIEW exercises for Automated Test, Industrial Measurement and Control and Embedded: www.ni.com/labview/whatis
• View DAQ product specs and demos: www.ni.com/daq
LabVIEW Graphical Programming Hands-On Seminar 73 ni.com
52
Software Maintenance and Support
Membership in a National Instruments software maintenance and support program allows you to:
•Receive software updates and maintenance releases automatically •Enjoy direct access to technical support from NI applications engineers •Access special online software training modules that highlight features, application uses, and development best practices
Visit ni.com/services to learn more
Software Maintenance Services for Single-Seat Users
Subscribe to a National Instruments software maintenance program and get the most out of your software investment. With a standard or premier
membership, you can stay up to date on the latest technology improvements by automatically receiving software updates and
maintenance releases. Additionally, you can reduce your application development time with direct access to technical support from NI
applications engineers. You also have access to special online, on-demand software training modules and the opportunity to learn more about
features, application uses, and development best practices.
All customers automatically receive a one-year membership in the
Standard Service Program (SSP) with the purchase of most software products and bundles including NI Developer Suite .
Volume Licensing for Account Level Services
Simplify your software license management while purchasing National Instruments software at a discounted rate with the NI Volume License
Program (NI VLP). Benefits for end users include access to feature upgrades and maintenance releases, technical support from NI engineers,
and on-demand training. Benefits for companies include flexible purchasing and licensing with a single PO, volume-based discounts, and
simplified license management with NI Volume License Manager (VLM). The NI VLP is available to organizations with five or more licenses of the
same software package.
LabVIEW Graphical Programming Hands-On Seminar 74 ni.com
53
Training and Certification
Together, the National Instruments training and certification programs deliver the fastest, most certain route to increased proficiency and productivity using NI software and hardware.
NI Training: Build Your Knowledge
NI training helps you build the skills to
more efficiently develop robust,
maintainable applications. We provide
several training options including
classroom, self-paced, online, or on-site
training at your facility.
NI Certification: Validate Your Expertise
NI certification confirms your technical growth
and skill. This professional certification is ideal
for differentiating yourself from the competition
and making your own informed hiring and
outsourcing decisions.
Visit ni.com/training to learn more
Types of Training Classes
Classroom Training in Your Area Classroom training is considered the most effective form of learning.
Attending a class requires an investment of time and effort, but the rewards are significant. The classroom environment removes you from the
distractions of everyday work so you can focus on improving your development skills. You have the opportunity to interact with an
experienced certified instructor and discuss ideas and problems with your peers and colleagues.
Online Courses via the Internet By combining interactive learning technology over the Internet with live
instruction, NI online courses deliver many classroom course benefits. They also reduce your training and development costs by eliminating
travel, teleconferencing, and time away from work. Simulated classroom environments with certified instructors, comprehensive hands-on training
with interactive teaching tools, easy access to courses and recordings for review via the Internet, and customized training module availability offer
you a variety of instructor-led training options at the lowest prices.
On-Site Training at Your Facility If your organization has several employees who need to develop the skills
to effectively use National Instruments products, on-site training is a cost-effective solution. On-site courses bring the classroom learning experience
to your company's facilities. They not only eliminate travel and hotel
LabVIEW Graphical Programming Hands-On Seminar 75 ni.com
expenses but also give you the opportunity to modify the courses for your
company's specific needs.
Self-Paced Courses
National Instruments understands that you may not have the time or the resources to participate in an instructor-led training program. To
accommodate your unique needs, we offer a variety of instructional packages and tools designed to educate you on our products and
technologies - on your own and at your own pace.
Accreditation All NI courses are accredited by the National Society of Professional
Engineers. You are eligible for continuing education units (CEUs) after satisfactorily completing any NI courses.
54
Certified LabVIEW Developer
Exam
Certified LabVIEW Architect
Exam
Certified LabVIEW Associate
Developer Exam
LabVIEW
Core 1
LabVIEW
Core 2
LabVIEW
Core 3
Advanced
Architectures
for LabVIEW
Developer Senior Developer Software Architect
/ Project Manager
NI Certifications Align with Training
"Certification is an absolute must for anyone serious about calling himself a LabVIEW expert... At our organization, we require that every LabVIEW developer be on a professional path to become a Certified LabVIEW Architect."
- President, JKI Software, Inc.
Managing
Software
Engineering
in LabVIEW
Visit ni.com/training to learn more
•There is a close link between training and certification.
•Certification is a quantifiable way of ensuring individuals have developed the skills need to create applications.
NI also offers certifications for LabWindows/CVI and TestStand
LabVIEW Graphical Programming Hands-On Seminar 76 ni.com
56
Programming Approaches
Analysis Libraries
Deployment Targets
A Highly Productive Graphical Development Environment for Engineers and Scientists
Hardware APIs Custom User Interfaces
Technology Abstractions
LabVIEW is a development environment that has been built specifically for engineers and scientists with the intent of making them more productive
and ensuring that they have all the tools they need to prototype, design and build their applications.
How can we claim that LabVIEW makes you more productive?
LabVIEW makes users more productive because it provides all the tools engineers need in a single environment and ensures that they all work
and can be used together. The key is guaranteed compatibility between engineering tools.
Technology Abstractions? LabVIEW‟s compiler abstracts complex technological problems like
multicore, virtualization, memory allocation and network communication.
Hardware APIs? Over 8000 drivers for instruments and a wide-range of USB, PCI, and PXI
instruments make it easy to real-world signals into software.
G Programming Language G is a complete programming language, capable of solving the most
complex and advanced problems today. There are a variety of other programming approaches in LabVIEW, but G is the language that ties
them together
LabVIEW Graphical Programming Hands-On Seminar 77 ni.com
57
LabVIEW Modulesand Toolkits
.
59
LabVIEW Real-Time Module
• Rapidly develop deterministic
applications with graphical
programming
• Easily architect distributed control
and monitoring systems
• Eliminate time spent integrating
diverse I/O
LabVIEW Real-Time extends LabVIEW graphical programming to create applications with
deterministic, real-time performance. You can develop and debug your application using
familiar LabVIEW graphical programming on a Windows PC, and then download that
time-critical code to run embedded on RT Series hardware. Through LabVIEW Real-Time,
National Instruments is extending the simplicity of LabVIEW graphical programming for
widespread development and deployment of real-time applications without requiring in-
depth knowledge of real-time techniques.
LabVIEW Graphical Programming Hands-On Seminar 78 ni.com
60
LabVIEW FPGA Module
• Define custom FPGA I/O without VHDL programming
• Achieve hardware deterministic response within 25ns
• Execute tasks with true parallelism
NI CompactRIOR Series Intelligent DAQ
The National Instruments LabVIEW FPGA Module extends LabVIEW graphical
development to reconfigurable FPGAs on NI reconfigurable I/O (RIO) hardware. With the
NI LabVIEW FPGA Module, you can create custom I/O measurement and control
hardware without low-level hardware description languages or hardware board-level
design. You can use this custom hardware for unique timing and triggering routines,
ultrahigh-speed control, and interfacing to digital protocols.
61
LabVIEW Embedded Module for ARM®
Microcontrollers
• Over 260 supported
processors
• Integrated drivers for
analog, digital, and
communications
• Desktop Simulation
support for software
development
The LabVIEW Embeddded Module allows developers to Target over 260 different ARM
processors. LabVIEW provides integrated solutions for device drivers to access analog
and digital hardware. Depending on the hardware target LabVIEW can provide for
ethernet ,analog and digital I/O, Pulse Width Modulation, SPI/I2C, LCD, Power
Management. Additionally, a interrupt manager allows LabVIEW code to handle
hardware interrupts.
LabVIEW also provides a cycle accurate ARM simulator for running ARM targeted
application on a development system.
LabVIEW Graphical Programming Hands-On Seminar 79 ni.com
62
LabVIEW Datalogging and
Supervisory Control Module
• Graphical development for distributed
monitoring and control systems
• Trend real-time and historical data
• Log data from any networked I/O to a
historical database
• Monitor and log alarms and events
• Network LabVIEW Real-Time targets and
OPC devices
• Add security to LabVIEW user interfaces
The National Instruments LabVIEW Datalogging and Supervisory Control (DSC) Module is
the ideal LabVIEW add-on for developing your HMI/SCADA or high-channel-count
datalogging applications. With the NI LabVIEW DSC Module, you can interactively
develop a distributed monitoring and control system with tags ranging from a few dozen
to tens of thousands. It includes tools for logging data to a networked historical
database, real-time and historical trending, managing alarms and events, networking
LabVIEW Real-Time targets and OPC devices into one complete system, and adding
security to user interfaces.
63
NI Platform for Control
LabVIEW Development Environment
Control Design and
Simulation ModuleSystem ID Toolkit StateChart Module
LabVIEW Real-Time LabVIEW FPGA
cRIO, cFPPXI RIO/DAQ Devices
Targets
PID and Fuzzy Logic ToolkitSimulation Interface
ToolkitNI Motion Control
LV Microprocessor SDK
32-Bit mp
Before we dive into each area of the control design process, wanted to first introduce
some of the main LabVIEW software and hardware tools for controls. We‟ll be using
several of these tools today to explain capabilities throughout the design process.
LabVIEW Graphical Programming Hands-On Seminar 80 ni.com
64
LabVIEW Mobile Module
• Wireless communication with shared
variable
• Portable low-cost USB DAQ
The National Instruments LabVIEW Mobile Module extends the LabVIEW graphical
development environment to handheld devices, so you can easily create custom
applications to run on Microsoft Windows Mobile for Pocket PC devices.
The NI LabVIEW Mobile Module is compatible with several NI data acquisition devices,
including the USB-6008, USB-6009, CF-6004, DAQCard-6062E, DAQCard-6024E, and the
DAQCard-6036E. Using these hardware devices, you can build handheld measurement
systems for applications ranging from automotive service to field diagnostics to
physiological monitoring.
In addition, the LabVIEW Mobile Module works with the NI PCMCIA-4050 digital
multimeter (DMM), so you can build a customized DMM on your PDA. Using the LabVIEW
Mobile Module and an NI PCMCIA-CAN card, you can construct portable Controller Area
Network communication devices.
With the LabVIEW Mobile Module you can:
• Create custom handheld applications for Windows Mobile, Pocket PC, and select
Windows CE OS devices.
• Acquire data using NI CompactFlash DAQ and PCMCIA DAQCards, DMMs, and CAN
devices.
• Communicate using Bluetooth, Wi-Fi (802.11), SMS text messaging, e-mail, IrDA,
and serial protocols.
Target standard and industrial PDAs, PDAs with phone capabilities, and touch-panel
displays.
66
Academic
• Research
• Teaching
Unmanned Systems
• Autonomous Ground Systems
• Mobile Robot research (medical)
• Underwater, Aerial, Surface Vehicles
Fixed-Base Industrial
• NI Vision
• Denso Toolkit
LabVIEW Robotics 2009
•Search algorithms
•Robotics visualization
•Obstacle avoidance
•Kinematics
•Robotics Examples
•Sensor drivers
•Actuator drivers
•Driver project wizard
•RIO hardware wizard
•Template architectures
LabVIEW Graphical Programming Hands-On Seminar 81 ni.com
65
LabVIEW MathScript RT ModuleDeploy Your Custom .m Files to Embedded Hardware
• Speed and Memory Performance Comparable to G
• In-Node Context Help for Functions
• Strict Data Type Propagation
• Data Type Script Highlighting
LabVIEW MathScript adds math-oriented, textual programming to LabVIEW through a
native compiler for .m files. With over 800 built-in functions for signal processing,
analysis, math, and control, MathScript allows developers to reuse many of their existing
.m files. MathScript provides two methodologies for using it, an interactive and a
programmatic interface.
This functionality originally included in LabVIEW Base and Professional Packages, has
been reengineered for optimal performance in a Real-Time Operating System. Structural
changes to the underlying MathScript engine were made to ensure the most optimized
compiled code, resulting in the technology being packaged in the LabVIEW MathScript
RT Module for LabVIEW
67
LabVIEW 2009 for WSNDistributed Intelligence
• Customize node behavior with LabVIEW
Onboard processing averaging/scaling
Increase battery life
Increase acquisition performance
Interface with wide array of sensors
LabVIEW Wireless Sensor Network (WSN) Module
LabVIEW Graphical Programming Hands-On Seminar 82 ni.com
68
NI Vision Development Module
• LabVIEW programming libraries for
machine vision and image processing
• Includes Vision Assistant
Prototypes and benchmarks
applications
Generates complete code for
LabVIEW,
Visual Basic, and C
• Hundreds of tools to:
Enhance images
Check for presence
Locate features
Identify parts
Measure objects
The NI Vision Development Module is a suite of software tools that offers high-level
interactive software as well as low-level image processing functions. The Module includes
Vision Assistant, an interactive prototyping tool that accelerates your development, and
the Vision libraries, a collection of over 200 image processing and analysis functions.
These tools work together for fast application development for industrial and scientific
imaging applications
Vision Assistant is easy-to-use inspection software that does not require programming
yet is scalable to programming environments such as LabVIEW, Visual Basic, C, and
C++. Vision Assistant is ideal for applications where fast time to market and low cost of
ownership is a must. With Vision Assistant software you can quickly setup and
benchmark an imaging strategy using over hundreds of image processing and analysis
functions.
Enhance Images – Filter noise, remove distortion, apply real world units. In the image,
we‟re measuring the wrench in mm, not pixels
Check for Presence – Simplest vision inspection. Is everything there? Results in a P/F
result.
Locate Features – Usually with a pattern match. Often to find a fiducial in order to build
a coordinate system. Results in a location and rotation angle
Identify Parts – Reading text, tracking bar codes, classifying objects for sorting. Usually
returns text.
Measure Objects – Distance, radius, size, area. Usually returns a numerical value.
LabVIEW Graphical Programming Hands-On Seminar 83 ni.com
69
NI SoftMotion for Distributed Control
Deterministic
Ethernet
Deterministic Ethernet
CompactRIO
Stepper or Servo
Drive Interface Module
Stepper or Servo
Drive Interface Module
NI 9144 expansion chassis for CompactRIO
In 2008 National Instruments introduced the Deterministic Ethernet Expansion Chassis.
The NI 9144 is an 8-slot rugged chassis for NI C Series modules which you can use to
add deterministic, distributed I/O to programmable automation controller (PAC) systems.
With standard CAT 5 Ethernet cabling, it communicates deterministically with any NI
CompactRIO or real-time PXI system that has two Ethernet ports. You can daisy chain
multiple NI 9144 slave chassis from the controller to expand time-critical applications to
high-channel counts while maintaining hard determinism with minimal processor
resources.
Because the new C Series Drive Interface Modules are supported within the 9144
Ethernet expansion chassis, you can create powerfull motion applications that allow you
to distribute highly synchronized axis over large distances.
70
Motion Control with LabVIEW
• NI Motion Assistant
Interactive environment with 3D
visualization
Ready-to-run LabVIEW or C code creation
Easy trapezoidal or S-curve velocity profile
implementation
Teach pendant for easy prototyping
• NI SoftMotion Controller for CANopen
and IEEE 1394
• NI SoftMotion Development Module
Develop custom motion controllers in
LabVIEW Real-Time or LabVIEW FPGA
Additionally, LabVIEW offers you the flexibility of incorporating motion control into your
application. To facilitate this process, National Instruments offers a complete selection of
motion control software, controllers, and power drives that quickly and seamlessly
integrate into your automated test and machine control systems. The reduced
development time, easy connectivity, and integrated solutions combine to make you
even more successful.
The NI Motion Assistant is a flexible and easy-to-use development tool for building and
prototyping motion applications. Similar to the Vision Builder, the Motion Assistant can
LabVIEW Graphical Programming Hands-On Seminar 84 ni.com
also convert your motion prototype to LabVIEW code. The NI SoftMotion Controller for
CANopen and IEEE 1394 enables you to program intelligent drives with LabVIEW for your
distributed motion control applications.
NI SoftMotion Development Module for LabVIEW is for machine builders and OEMs
creating custom motion controllers for better machine performance and for researchers
implementing advanced control design algorithms for motion control. The module
includes functions for trajectory generation, spline interpolation, position and velocity PID
control and encoder implementation. Using the NI SoftMotion development module you
can create your custom motion controller in software.
71
LabVIEW Touch Panel Module
• Create custom
human-machine
interface (HMI)
applications for the NI
TPC-2006 and other
Windows CE devices
Create custom human-machine interface (HMI) applications for the NI TPC-2006 and other Windows CE devices
NI TPC-2006
With the National Instruments LabVIEW Touch Panel Module, you can develop custom
human-machine interface (HMI) monitoring and control applications for select Windows
CE touch panel devices, such as the NI TPC-2006. These HMI touch panel applications
are useful for communicating with and displaying information from headless devices such
as the National Instruments Compact FieldPoint, CompactRIO, and Compact Vision
System programmable automation controllers (PACs) or any other LabVIEW Real-Time
target. The LabVIEW Touch Panel Module includes built-in features and tools for user
interface development, data analysis, and communication.
LabVIEW Graphical Programming Hands-On Seminar 85 ni.com
72
LabVIEW Statechart Module• Statecharts provide high-level
abstraction for state based
applications
Simple semantics represent complex
systems
Self-documenting design
• Integrate statecharts into existing
LabVIEW applications
• Generate code for desktop, Real-time,
FPGA, and embedded targets
Simplify complex state-based applications with the National Instruments LabVIEW
Statechart Module. The NI LabVIEW Statechart Module provides a high level of
abstraction for designing applications using states, transitions, and events. When
combined with LabVIEW Embedded technology, engineers can deploy applications built
with statecharts using the LabVIEW Real-Time, LabVIEW FPGA, LabVIEW Code
Generation, LabVIEW PDA, and LabVIEW Touch Panel modules.
73
LabVIEW Sound and Vibration Toolkit10 Express VIs
• Fractional Octave Analysis withWeighting
• Vibration Level with Single or Double Integration
• Sound Level with A-, B-, C-Weighting
• Power Spectrum
• Zoom Power Spectrum
• Frequency Response
• Peak Search
• Power in Band
• Limit Testing
The Sound and Vibration Toolset extends the functionality of LabVIEW to handle system
calibration, frequency analysis, transient analysis, sound level measurements, and
fractional-octave analysis, providing you with a customizable software foundation for
your sound and vibration applications. Sound and vibration analysis often begins with
signal acquisition using microphones, accelerometers, displacement probes, or
tachometers.
Following the acquisition, you can associate the incoming signal with characteristics such
as sensor sensitivity, an engineering unit, or a dB reference. The built-in fractional-
octave analysis and sound level measurement routines also feature averaging, allowing
you to perform fractional-octave analysis with any number of bands at several different
bandwidths. Octave and sound level measurement functions offer tools for linear
averaging, exponential averaging, and peak hold. Exponential averaged measurements
provide arbitrary, standard, slow, fast, and impulse time constants.
LabVIEW Graphical Programming Hands-On Seminar 86 ni.com
74
LabVIEW Order Analysis Toolkit
• Gabor order tracking algorithm analyzes signals from rotating machinery
• Resampling order analysis for online condition monitoring
• Flexible order energy selection in the joint time-frequency domain
• Plot order versus time or RPM
• Order extraction tools separate order-specific signal components
• Digital and analog tachometer signal processing
Order analysis is a tool for examining dynamic signals generated by mechanical systems
that include rotating or reciprocating components. As with frequency-domain analysis,
you can think of order analysis as a signal scalpel that can dissect sound, vibration, and
other dynamic signals into components that relate to physical elements of mechanical
systems. Unlike the power spectrum and other frequency-domain analysis standards,
order analysis works even when the signal source undergoes rotational speed variations.
The LabVIEW Order Analysis Toolset gives the power to create applications for order
tracking, order extraction, and tachometer signal processing. The toolset employs Gabor
Order Tracking, a patent-pending algorithm based on the ideas of Joint Time-Frequency
Analysis (JTFA).
75
PID Control Toolkit
• PID Control
Autotuning
Gain scheduling
• Fuzzy Logic
Control strategies
Decision making
To quickly develop automated control applications, the PID Control Toolset provides
sophisticated control algorithms for PID and fuzzy logic control. The PID tools implement
a wide range of PID algorithms and feature autotuning and gain scheduling to improve
system performance. For nonlinear or highly complex systems, the fuzzy logic tools
accelerate development by implementing control strategies through simple linguistic
rules. You can also use the tools for decision making, such as pattern recognition or fault
diagnosis.
LabVIEW Graphical Programming Hands-On Seminar 87 ni.com
76
Report Generation Toolkit for MS Office
• Programmatically create and edit reports in Microsoft Word and Excel
• Populate report templates
• Manage report layout, format, and appearance
• E-mail reports and run macros
• Express VI included
The LabVIEW Report Generation Toolkit for Microsoft Office is a library of flexible, easy-
to-use VIs for programmatically creating and editing Microsoft Word and Excel reports
from LabVIEW. The Toolkit supplies powerful functions to quickly create professional
reports, giving you the flexibility you need to manage every facet of your presentation,
from content to layout and appearance.
With this toolkit, you can:
• Create and edit reports containing text, tables, graphs, and pictures
• Create reports from templates using Word bookmarks or Excel named ranges as
placeholders
• Set report formatting (headers, footers, page numbers, fonts, borders, colors, text
alignment, and so on)
• Sort data in Excel worksheets
• E-mail reports
• Run Visual Basic (VBA) macros in reports
Create custom report generation functions
LabVIEW Graphical Programming Hands-On Seminar 88 ni.com
77
LabVIEW Advanced Signal Processing
Toolkit• Time-Frequency Analysis
• Time-Series Analysis
• Wavelet and filter bank design
• Applications
Automotive
Biomedical
Seismology
Radar/Sonar
Now that we have seen the vast analysis capabilities built into LabVIEW, let‟s take a look
at some of the specialized analysis you can perform with the LabVIEW Add-on Toolsets.
The Signal Processing Toolset provides powerful tools for Joint Time-Frequency Analysis
(JTFA), digital filter design, super-resolution spectral analysis, and wavelet/filter bank
design.
With the JTFA portion of the toolset you can simultaneously examine the time and
frequency domain representations of a signal. Quickly design lowpass, highpass,
bandpass, and bandstop FIR and IIR filters interactively and output filter coefficients for
use in LabVIEW and other applications. Super-resolution spectral analysis provides a
model-based alternative to the FFT and delivers estimates of amplitude, phase, damping
factor, and frequency of the damped sinusoidal components of a signal.
The wavelet and filter bank design component decompose a signal into multiple bands,
representing the signal in terms of varying time and scales through a bank of filters. This
decomposition facilitates extraction of signal features, noise reduction, and other
operations.
LabVIEW Graphical Programming Hands-On Seminar 89 ni.com
78
Database Connectivity Toolkit
• Insert, select data from OLE DB, ODBC databases Microsoft Access, SQL Server, Oracle, etc.
• Create, drop tables
• Save records in XML format
• Execute SQL queries Immediate, parameterized
• Execute stored procedures
• Accept, reject multiple operations (transactions)
The LabVIEW Database Connectivity Toolset is a set of high-level tools for accessing local
and remote databases from LabVIEW. It incorporates the latest technologies, such as
Microsoft ActiveX Data Objects (ADO) to deliver high-speed performance with low
memory overhead.
With the Database Connectivity Toolset, you can:
• Insert and select data from databases
• Create and drop database tables
• List the tables and columns in a database
• Accept or reject multiple database operations (transactions) based on user-defined
criteria
• Execute Structured Query Language (SQL) statements
• Execute stored procedures in a database
• Select information in a database and save it to a file in Extensible Markup Language
(XML) format
The Database Connectivity Toolset readily connects to popular databases such as
Microsoft Access, SQL Server, and Oracle. It also can connect to other databases if you
install the appropriate ADO-compliant OLE DB provider or ODBC driver from Microsoft or
the database vendor.
The Database Connectivity Toolset is part of the Enterprise Connectivity Toolset.
79
LabVIEW DataFinder ToolkitDevelop Custom Data Management
Applications
LabVIEW Graphical Programming Hands-On Seminar 90 ni.com
80
Profile LabVIEW applications at run time
NI Desktop Execution Trace ToolkitPerform Dynamic Code Analysis
81
VI Under Test
Input Values Output
Expected OutputUnit Test
FrameworkAutomated
Report Generation
Test vector = Input value(s) + Expected output(s)
LabVIEW Unit Test Framework ToolkitAutomate Unit Testing and Regression Testing
The idea behind unit testing is elegant and simple, but can be expanded to enable
sophisticated series of tests for code validation and regression testing. A unit test is
strictly something that „exercises‟ or runs the code under test. Many developers
manually perform unit testing on a regular basis in the course of working on a segment
of code. In other words, it can be as simple as „I know the code should perform this
task when I supply this input; I’ll try it and see what happens.’ If it doesn‟t behave as
expected, the developer would likely modify the code and repeat this iterative process
until it works.
The problem with doing this manually is that it can easily overlook large ranges of values
or different combinations of inputs and it offers no insight into how much of the code was
actually executed during testing. Additionally, it does not help us with the important task
of proving to someone else that it worked and that it worked correctly. The cost and
time required is compounded by the reality that one round of testing is rarely enough;
besides fixing bugs, any changes that are made to code later in the development process
may require additional investment of time and resources to ensure it‟s working properly.
The ability to prove it works requires the creation of documentation or evidence that the
software fulfills its‟ intended purpose and meets all other criteria. The LabVIEW Unit Test
Framework enables automated generation of documentation in XML (ATML), HTML or
ASCII formats. Information included in this report can be configured, but typically
includes the time of test, duration of each test, test vector inputs, the results, and
aggregated code coverage metrics.
top related