Sie sind auf Seite 1von 27

Using LabVIEW Templates and

Sample Projects for Desktop


Applications
Brian Reiche
Account Manager, Eastern Virginia

Mark Lewis
Account Manager, Navy and NASA

ni.com

Agenda

Lunch and Networking


Presentation on Design Templates in LabVIEW 2012
LabVIEW Coding Challenge

ni.com

What Are Templates and Sample Projects?


Template
Boilerplate project, code,
documentation, and folder
structure

Sample Project
A working application that is a
starting point for customization
Typically based on a template
ni.com

Why Use a Template or a Sample Project?


Increase efficiency

Reduce errors
Increase reuse

Shorten learning curves

When you develop applications with LabVIEW


ni.com

LabVIEW 2012 Templates/Sample Projects

ni.com

Simple State Machine


Covered in this
Queued Message Handler
presentation
Finite Measurement
Continuous Measurement and Logging
Actor Framework
Feedback Evaporative Cooler
Continuous Measurement and Logging (NI-DAQmx)
Finite Measurement (NI-DAQmx)
LabVIEW Real-Time Control (NI-DAQmx)
LabVIEW Real-Time Waveform Acquisition and Logging (NI-DAQmx)
LabVIEW FPGA Control on CompactRIO
LabVIEW FPGA Waveform Acquisition and Logging on CompactRIO
LabVIEW Real-Time Control on CompactRIO (RIO Scan Interface)
LabVIEW FPGA Project
Instrument Driver Project
Robotics Project
Touch Panel Project
5

Desktop Templates
Template

Description

Blank Project
Blank VI
Simple State Machine

Customizable execution sequence for sections of


code

Queued Message Handler

Sections of code running in parallel and sending


data or messages between them

Actor Framework

Multiple, independent tasks that communicate


with each other (uses LV Classes extensively)

Instrument Driver Project

Create new instrument driver project wizard


present in previous versions of LabVIEW

ni.com

Desktop Sample Projects


Template

Root Template

Finite Measurement

Simple State Machine

Continuous Measurement and Logging

Queued Message Handler

Feedback Evaporative Cooler

Actor Framework

DAQmx variants of sample projects are installed by NI-DAQmx installer

ni.com

Create Project Dialog


Open
documentation
in new window

Filter by
type or
target

Filter by
keyword
search

ni.com

More Information

ni.com

10

Configuring Your Project


Optional prefix
helps keep files
distinctly
named

Project
name
used in
folder
and file
names

Icon overlay
visually
associates
created VIs
with this
project

Root must be
an empty
folder

ni.com

11

Simple State Machine

Project
organized using
folders

ni.com

<Replace Me> text lets you


know which controls to replace
12

Simple State Machine Block Diagram


Blue Code
Needed
comments tell
you where to
make changes

Comments
give high
level
insight
about the
code
ni.com

13

Simple State Machine Block Diagram

Event structure
instead of
polling in wait
state

ni.com

14

Finite Measurement
Sample Project

ni.com

15

Finite Measurement
Sample Project
Initialize
Copy Graph
Stop

Export Data

Wait for Event

Save Data

Load Data

Acquire
Acquire

Configure
Configure

Update UI

ni.com

16

Analyze
Analyze

Clear Data

Queued Message Handler


Template

ni.com

17

Queued Message Handler


Template

UI event capture loop

Message handling loop


Queue
setup

ni.com

18

Queued Message Handler


Template

UI event capture loop

Message handling loop

ni.com

Create queue for message communication and user


event to stop event loop
19

Queued Message Handler


Template

Event structure
in its own loop

String messages
added to a queue

Message handling loop


Queue
setup

ni.com

20

Queued Message Handler


Template

UI event capture loop


Subsequent
operations
added to
queue

Queue
setup

ni.com

Message strings dequeued and passed


to case structure
21

Continuous Measurement and Logging


Sample Project

ni.com

22

Continuous Measurement and Logging


Sample Project

UI event capture loop

Queue,
event,
and
notifier
setup

UI message handling loop

Acquisition message loop


Logging message loop
Data display loop

ni.com

23

Continuous Measurement and Logging


Sample Project
Command via queue

UI event capture loop

Data via queue


Data via notifier

Queue,
event,
and
notifier
setup

UI message handling loop

Acquisition message loop


Logging message loop
Data display loop

ni.com

24

Continuous Measurement and Logging


Sample Project

UI event capture loop

Queue,
event,
and
notifier
setup

UI message handling loop

Data display loop


ni.com

25

Acquisition and logging


loops encapsulated in
subVIs

Continuous Measurement and Logging


Sample Project

UI event capture loop

Queue,
event,
and
notifier
setup

UI message handling loop

Data display loop


ni.com

26

Acquisition and logging


loops encapsulated in
subVIs

Continuous Measurement and Logging


Sample Project

UI event capture loop

UI message handling loop

Acquisition message loop


Logging message loop
Data display loop uses
notifier rather than a
queue
ni.com

27

Templates and Sample Projects


What AreTemplates and Sample Projects?

Why Use aTemplate or a Sample Project?


Increase efficiency

Template
Boilerplate project, code,
documentation, and folder
structure

Reduce errors
Increase reuse

Sample Project

Shorten learning curves

A working application that is a


starting point for customization
Typically based on a template

When you develop applications with


LabVIEW

Try them next time you start a new project


Post in the forums (forums.ni.com) if you have questions

ni.com

28

Das könnte Ihnen auch gefallen