using labview templates and sample projects for desktop applications

26
Using LabVIEW Templates and Sample Projects for Desktop Applications ni.com

Upload: independent

Post on 01-Dec-2023

0 views

Category:

Documents


0 download

TRANSCRIPT

Using LabVIEW Templates and Sample Projects for Desktop

Applications

ni.com

What Are Templates and Sample Projects?

TemplateBoilerplate project, code,

documentation, and folder

structure

2ni.com

Sample ProjectA working application that is a

starting point for customization

Typically based on a template

Why Use a Template or a Sample Project?

Increase efficiency

Reduce errors

Increase reuse

3ni.com

Shorten learning curves

When you develop applications with LabVIEW

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)

Covered in this

presentation

4ni.com

• 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

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

5ni.com

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

Desktop Sample Projects

Template RootTemplate

Finite Measurement Simple State Machine

Continuous Measurement and Logging Queued Message Handler

Feedback Evaporative Cooler Actor Framework

6ni.com

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

Create Project Dialog

Filter by

type or

target

Open

documentation

in new window

7ni.com

Filter by

keyword

search

More Information…

8ni.com

Configuring Your Project

Project

name

used in

folder

and file

names

Optional prefix

helps keep files

distinctly

named

9ni.com

names

Root must be

an empty

folder

Icon overlay

visually

associates

created VIs

with this

project

Simple State Machine

10ni.com

Project

organized using

folders <Replace Me> text lets you

know which controls to replace

Simple State Machine Block DiagramBlue “Code

Needed”

comments tell

you where to

make changes

11ni.com

Comments

give high

level

insight

about the

code

Simple State Machine Block Diagram

Event structure

instead of

polling in wait

12ni.com

polling in wait

state

Finite MeasurementSample Project

13ni.com

InitializeInitializeInitializeInitialize

Wait for EventWait for EventWait for EventWait for Event

StopStopStopStop

Save DataSave DataSave DataSave DataSave DataSave DataSave DataSave Data

Export DataExport DataExport DataExport DataExport DataExport DataExport DataExport Data

Copy GraphCopy GraphCopy GraphCopy GraphCopy GraphCopy GraphCopy GraphCopy Graph

Finite Measurement

Wait for EventWait for EventWait for EventWait for EventWait for EventWait for EventWait for EventWait for Event

Sample Project

14ni.com

Update UIUpdate UIUpdate UIUpdate UI

ConfigureConfigureConfigureConfigureAcquireAcquireAcquireAcquireLoad DataLoad DataLoad DataLoad Data Clear DataClear DataClear DataClear DataAnalyzeAnalyzeAnalyzeAnalyze

Save DataSave DataSave DataSave DataSave DataSave DataSave DataSave Data

ConfigureConfigureConfigureConfigureConfigureConfigureConfigureConfigureAcquireAcquireAcquireAcquireAcquireAcquireAcquireAcquire AnalyzeAnalyzeAnalyzeAnalyzeAnalyzeAnalyzeAnalyzeAnalyze

Queued Message HandlerTemplate

15ni.com

Queued Message Handler

UI event capture loopUI event capture loop

Template

16ni.com

Message handling loopMessage handling loop

Queue

setup

Queue

setup

Queued Message Handler

UI event capture loopUI event capture loop

Template

17ni.com

Message handling loopMessage handling loop

Create queue for message communication and user

event to stop event loop

Queued Message HandlerEvent structure

in it’s own loop

String messages

added to a queue

Template

18ni.com

Message handling loopMessage handling loop

Queue

setup

Queue

setup

Queued Message Handler

Subsequent

operations

added to

UI event capture loopUI event capture loop

Template

19ni.com

Queue

setup

Queue

setup

added to

queue

Message strings dequeued and passed

to case structure

Continuous Measurement and LoggingSample Project

20ni.com

Continuous Measurement and Logging

UI event capture loopUI event capture loop

Sample Project

21ni.com

UI message handling loopUI message handling loopQueue,

event,

and

notifier

setup

Queue,

event,

and

notifier

setupAcquisition message loopAcquisition message loop

Logging message loopLogging message loop

Data display loopData display loop

Continuous Measurement and Logging

UI event capture loopUI event capture loop

Command via queue

Data via queue

Data via notifier

Sample Project

22ni.com

UI message handling loopUI message handling loopQueue,

event,

and

notifier

setup

Queue,

event,

and

notifier

setupAcquisition message loopAcquisition message loop

Logging message loopLogging message loop

Data display loopData display loop

Continuous Measurement and Logging

UI event capture loopUI event capture loop

Sample Project

23ni.com

UI message handling loopUI message handling loopQueue,

event,

and

notifier

setup

Queue,

event,

and

notifier

setup

Data display loopData display loopAcquisition and logging

loops encapsulated in

subVIs

Continuous Measurement and Logging

UI event capture loopUI event capture loop

Sample Project

24ni.com

UI message handling loopUI message handling loopQueue,

event,

and

notifier

setup

Queue,

event,

and

notifier

setup

Data display loopData display loopAcquisition and logging

loops encapsulated in

subVIs

Continuous Measurement and Logging

UI event capture loopUI event capture loop

Sample Project

25ni.com

UI message handling loopUI message handling loop

Acquisition message loopAcquisition message loop

Logging message loopLogging message loop

Data display loop uses

notifier rather than a

queue

Templates and Sample Projects

Increase efficiency

Reduce errors

Increase reuse

Shorten learning curves

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?

26ni.com

When you develop applications with

LabVIEW

Typically based on a template

• Try them next time you start a new project

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