Using LabVIEW Templates and Sample Projects for Desktop Applications

27
ni.com Using LabVIEW Templates and Sample Projects for Desktop Applications Brian Reiche Account Manager, Eastern Virginia Mark Lewis Account Manager, Navy and NASA

description

LabVIEW Desktop App

Transcript of Using LabVIEW Templates and Sample Projects for Desktop Applications

Page 1: Using LabVIEW Templates and Sample Projects for Desktop Applications

ni.com

Using LabVIEW Templates and Sample Projects for Desktop

Applications

Brian Reiche

Account Manager, Eastern Virginia

Mark Lewis

Account Manager, Navy and NASA

Page 2: Using LabVIEW Templates and Sample Projects for Desktop Applications

2 ni.com

Agenda

• Lunch and Networking

• Presentation on Design Templates in LabVIEW 2012

• LabVIEW Coding Challenge

Page 3: Using LabVIEW Templates and Sample Projects for Desktop Applications

3 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

Page 4: Using LabVIEW Templates and Sample Projects for Desktop Applications

4 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

Page 5: Using LabVIEW Templates and Sample Projects for Desktop Applications

5 ni.com

LabVIEW 2012 Templates/Sample Projects

• Simple State Machine

• Queued Message Handler

• 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

Covered in this presentation

Page 6: Using LabVIEW Templates and Sample Projects for Desktop Applications

6 ni.com

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

Page 7: Using LabVIEW Templates and Sample Projects for Desktop Applications

7 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

Page 8: Using LabVIEW Templates and Sample Projects for Desktop Applications

9 ni.com

Create Project Dialog

Filter by type or target

Filter by keyword search

Open documentation in new window

Page 9: Using LabVIEW Templates and Sample Projects for Desktop Applications

10 ni.com

More Information…

Page 10: Using LabVIEW Templates and Sample Projects for Desktop Applications

11 ni.com

Configuring Your Project

Project name used in folder and file names

Root must be an empty folder

Optional prefix helps keep files distinctly named

Icon overlay visually associates created VIs with this project

Page 11: Using LabVIEW Templates and Sample Projects for Desktop Applications

12 ni.com

Simple State Machine

Project organized using folders <Replace Me> text lets you

know which controls to replace

Page 12: Using LabVIEW Templates and Sample Projects for Desktop Applications

13 ni.com

Simple State Machine Block Diagram Blue “Code Needed” comments tell you where to make changes

Comments give high level insight about the code

Page 13: Using LabVIEW Templates and Sample Projects for Desktop Applications

14 ni.com

Simple State Machine Block Diagram

Event structure instead of polling in wait state

Page 14: Using LabVIEW Templates and Sample Projects for Desktop Applications

15 ni.com

Finite Measurement Sample Project

Page 15: Using LabVIEW Templates and Sample Projects for Desktop Applications

16 ni.com

Initialize

Wait for Event

Update UI

Configure Acquire Load Data Clear Data Analyze

Stop

Save Data

Export Data

Copy Graph

Finite Measurement

Wait for Event

Configure Acquire Analyze

Sample Project

Page 16: Using LabVIEW Templates and Sample Projects for Desktop Applications

17 ni.com

Queued Message Handler Template

Page 17: Using LabVIEW Templates and Sample Projects for Desktop Applications

18 ni.com

Queued Message Handler

UI event capture loop

Message handling loop

Queue setup

Template

Page 18: Using LabVIEW Templates and Sample Projects for Desktop Applications

19 ni.com

Queued Message Handler

UI event capture loop

Message handling loop

Create queue for message communication and user event to stop event loop

Template

Page 19: Using LabVIEW Templates and Sample Projects for Desktop Applications

20 ni.com

Queued Message Handler

Message handling loop

Queue setup

Event structure in it’s own loop

String messages added to a queue

Template

Page 20: Using LabVIEW Templates and Sample Projects for Desktop Applications

21 ni.com

Queued Message Handler

Queue setup

Subsequent operations added to queue

Message strings dequeued and passed to case structure

UI event capture loop

Template

Page 21: Using LabVIEW Templates and Sample Projects for Desktop Applications

22 ni.com

Continuous Measurement and Logging Sample Project

Page 22: Using LabVIEW Templates and Sample Projects for Desktop Applications

23 ni.com

Continuous Measurement and Logging

UI event capture loop

UI message handling loop Queue, event, and notifier setup

Acquisition message loop

Logging message loop

Data display loop

Sample Project

Page 23: Using LabVIEW Templates and Sample Projects for Desktop Applications

24 ni.com

Continuous Measurement and Logging

UI event capture loop

UI message handling loop Queue, event, and notifier setup

Acquisition message loop

Logging message loop

Data display loop

Command via queue

Data via queue

Data via notifier

Sample Project

Page 24: Using LabVIEW Templates and Sample Projects for Desktop Applications

25 ni.com

Continuous Measurement and Logging

UI event capture loop

UI message handling loop Queue, event, and notifier setup

Data display loop Acquisition and logging loops encapsulated in subVIs

Sample Project

Page 25: Using LabVIEW Templates and Sample Projects for Desktop Applications

26 ni.com

Continuous Measurement and Logging

UI event capture loop

UI message handling loop Queue, event, and notifier setup

Data display loop Acquisition and logging loops encapsulated in subVIs

Sample Project

Page 26: Using LabVIEW Templates and Sample Projects for Desktop Applications

27 ni.com

Continuous Measurement and Logging

UI event capture loop

UI message handling loop

Acquisition message loop

Logging message loop

Data display loop uses notifier rather than a queue

Sample Project

Page 27: Using LabVIEW Templates and Sample Projects for Desktop Applications

28 ni.com

Templates and Sample Projects

Increase efficiency

Reduce errors

Increase reuse

Shorten learning curves

When you develop applications with

LabVIEW

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

Why Use a Template or a Sample Project?

• Try them next time you start a new project

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