Sie sind auf Seite 1von 82

LabVIEW Course

Course 1

Graphical Programming for


Test, Measurement, and
Control
Rapid application development
and easy-to-use graphical
environment
Interactive measurement
assistants and powerful
redesigned DAQ interface for
connecting to all types of I/O

Labview 2009-2010

Acquire, Analyze, and Present


Nearly all test, measurement, and control applications can be
divided into 3 main components: the ability to acquire, analyze, and
present data.
LabVIEW = acquiring, analyzing, and presenting real-world data.

Labview 2009-2010

Acquire with LabVIEW


LabVIEW can acquire data using the
following devices and more:
GPIB, Serial, Ethernet, VXI, PXI
Instruments
Data Acquisition (DAQ)
PCI eXtensions for Instrumentation (PXI)
Image Acquisition (IMAQ)
Motion Control
Real-Time (RT) PXI
PDA
Modular Instruments

Labview 2009-2010

Analyze with LabVIEW


LabVIEW includes the following tools to help
you analyze your data:

Powerful measurement
analysis is built in to the
LabVIEW development
environment.

Labview 2009-2010

More than 400 measurement analysis functions for


Differential Equations, Optimization, Curve Fitting,
Calculus, Linear Algebra, Statistics, etc.
12 new Express VIs specifically designed for
measurement analysis, including filtering and spectral
analysis
Signal Processing VIs for Filtering, Windowing,
Transforms, Peak Detection, Harmonic Analysis,
Spectrum Analysis, etc.

Present with LabVIEW


LabVIEW includes the following tools to
help you present your data:

Presentation with
LabVIEW can be done
on your PC or over a
network

Labview 2009-2010

On your machine Graphs, Charts, Tables,


Gauges, Meters, Tanks, 3D Controls, Picture
Control, 3D Graphs (Windows Only), Report
Generation (Windows Only)
Over the Internet Web Publishing Tools,
Datasocket (Windows Only), TCP/IP, VI Server,
Remote Panels, Email
Enterprise Connectivity Toolset SQL Tools
(Databases), Internet Tools (FTP, Telnet, HTML)

Course Goals
Introduction to graphical programming environment
(Front Panel / Block Diagram / Connector/icons)

Presentation of the key points for Labview programming


(Vi / Sub Vi / Data types / Structures)

Introduction to debugging techniques

Labview 2009-2010

Course evaluation
Fields
Files organization
Quality of user interfaces
Quality of programs
Behavior during the course

Labview 2009-2010

Weight
20%
30%
30%
20%

Course Map
Course 1

First steps
with LabVIEW

Course 2

Course 3

Making a decision
Controlling property

Loops
Creation of new VI
and customization

Arrays
Project

Modular
programming

Signal
generation
Saving data

Analyzing and
Data
acquisition
saving
data

Labview 2009-2010

Express VI

Lesson 1
Introduction to LabVIEW
TOPICS
LabVIEW Environment
Front Panel
Block Diagram
Dataflow Programming
Customization of VI
Labview 2009-2010

10

To start

open LV_Getting_Started_Eng_2011.pdf
and follow instructions until page 20 !

Labview 2011-2012

11

Summary
New Dialog Box and Template VIs
Front Panel
Block Diagram
VI, Express Vis, functions, data formats
Front Panel and Block Diagram Tools
Running and Stopping a VI, Toolbars
LabVIEW Documentation Resources
Property Dialog Boxes
Shortcuts

Labview 2011-2012

12

How is composed a
Virtual Instrument (VI)
Front Panel
Controls = Inputs
Indicators = Outputs

Block Diagram
Accompanying program
for front panel
Components wired
together
Labview 2009-2010

13

How is composed the Front Panel Window


Front Panel
Toolbar
Free Text
Numeric
Control
Numeric
Indicator

VI Icon

Simple
Numeric
Indicator

Waveform
Graph
Scale
Legend

Labview 2009-2010

14

How is composed the Block Diagram Window


Block
Diagram
Toolbar
SubVI
(VI Express)
Numeric
Constant

Graph
Terminal

Wire
Data

Numerical
Indicator
Terminal

While Loop
Structure
Timing
Function
Labview 2009-2010

Boolean Control
Terminal
15

Express VIs, VIs and Functions


Express VIs: interactive VIs with configurable dialog page
Standard VIs: modularized VIs customized by wiring
Functions: fundamental operating elements of
LabVIEW; no front panel or block diagram

Labview 2009-2010

16

Different data formats


Scalar

1D Array

2D Array

Numeric

Boolean
String
Dynamic

Labview 2009-2010

17

Tools Palette
LabVIEW can automatically select the tool needed
Available on the front panel and the block diagram
A tool is a special operating mode of the mouse cursor
Use the tools to operate and modify front panel and
block diagram objects
To show the tools palette, select
WindowShow Tools Palette

Labview 2009-2010

18

Front Panel Controls Palette

Controls Palette
Contains the most commonly used controls

All Controls Palette


Shows all controls

Labview 2009-2010

19

Block Diagram Functions Palette

Functions Palette
Contains the Express VIs (interactive VIs with
configurable dialog page) and the most commonly
used functions

All Functions Palette


Shows all functions

Labview 2009-2010

20

Tools Palette
Click pushpin to tack down palette

Up to Owning Search Palette Options


Palette

Graphical, floating palettes


Subpalettes can be converted to floating palettes
Use Palette Options to change palette view from
Express to Advanced
Labview 2009-2010

21

Menu

File Edit Operate Tools Browse Window Help

Labview 2009-2010

22

Front Panel and Block Diagram Toolbars


Run button

Font ring

Continuous Run button

Alignment ring

Abort button

Distribution ring

Pause/Continue button

Resize ring
Reorder ring

Warning indicator
Enter button
Broken Run button

Labview 2009-2010

Additional Buttons on the


Context Help Button
Block Diagram Toolbar
Execution Highlighting button
Step Into button
Step Over button
Step Out button

23

Labview help
1. Information about LabVIEW programming
concepts, step-by-step instructions for using
LabVIEW, and
2. Reference information about LabVIEW VIs,
functions, palettes, menus, tools, properties,
methods, events, dialog boxes, and so on.

Labview 2011-2012

24

Property Page
Right-click a control or
indicator on the front
panel and select
Properties from the
shortcut menu to access
the property dialog box
for that object

Labview 2009-2010

25

Some shortcuts

Labview 2011-2012

26

Lesson 2
Creation of a new VI and customization
TOPICS
New VI creation
Dataflow Programming
Customization of VI

Labview 2009-2010

27

Exercise 2.1 - Convert K to F


Goal
Create a simple VI
Topic : convert a Kelvin temperature into Fahrenheit

Concepts

Simple mathematic function, numeric format


Commands and indicators
Dataflow, help, debugging
Displays customized

Homework
Open a new VI
Build a VI that converts K to F
Save in 1_KtoF.vi

Labview 2009-2010

28

Step 1 : Creating a new VI


FileNew VI to open a blank VI

FileNew to open the New dialog box and configure a VI template,


global variable, control, etc

Labview 2009-2010

29

Composition of a new VI

Diagram (D)
Front Panel (FP)

Labview 2009-2010

30

Creating a VI Front Panel


Build the front panel with controls (inputs)
and indicators (outputs)

Owned
Labels

Boolean
Control

Labview 2009-2010

Boolean
Indicator

Increment
Buttons

Numeric
Indicator

Numeric
Control

31

Step 2 : Create the Front Panel


Create this Front Panel using the Controls Palette

Labview 2009-2010

32

Shortcut Menus for Front Panel Objects


Right-click the digital display
to access its shortcut menu
Right-click the label to
access its shortcut menu

Labview 2009-2010

33

Step 3 : Creating a VI Block Diagram


Front Panel

Indicator

Control

Block Diagram
Control
Terminal

Labview 2009-2010

Constant

Wires

Nodes

Indicator
Terminal

34

Wiring Techniques

Hot Spot

Automatic Wiring
Use Context Help Window when wiring
Right-click wire and select Clean Up Wire
Tip Strips
Automatic wire routing
Right-click terminals
and select Visible
ItemsTerminals
View the terminal connections to a function

Labview 2009-2010

35

Block Diagram Terminals


Terminals are entry and exit ports
that exchange information between
the panel and diagram
Terminals are analogous to
parameters and constants in textbased programming languages
Right-click and toggle View As Icon
to change the icon view

Labview 2009-2010

36

Context Help
To display the Context Help window, select
HelpShow Context Help, press the <Ctrl-H> keys, or press
the Show Context Help Window button in the toolbar
Move cursor over object
to display help
Connections:
Required bold
Recommended normal
Optional - dimmed
Simple/Detailed Context Help

Labview 2009-2010

Lock Help

More Help

37

LabVIEW Help
Click the More Help button in the Context Help window
Select HelpVI, Function, & How-To Help
Click the sentence Click here for more help in the Context
Help window.
Contains detailed descriptions of most palettes, menus,
tools, VIs, and functions, step-by-step instructions for using
LabVIEW features, links to the LabVIEW Tutorial, PDF
versions of all the LabVIEW manuals and Application Notes,
and technical support resources.

Labview 2009-2010

38

Dataflow Programming
Block diagram executes
dependent on the flow of data;
block diagram does NOT
execute left to right
Node executes when data is
available to ALL input terminals
Nodes supply data to all output
terminals when done

Labview 2009-2010

39

Step IV : Save the VI

Save the VI as 1_KtoF.vi


(in a specific folder)

Then execute it !

Labview 2009-2010

40

Customization of displays
Goals
Insert comments for users
Adapt displays to the application

What sort of customization ?


Free text
Models of commands and indicators
Scale

Labview 2009-2010

41

1) Free text
Useful to inform user
Authorized on FP et D
In example,
1. Add something like : Temperature conversion .
2. Then, change font, size, color (via FP Toolbar)

Labview 2009-2010

42

2) Customization of displays

1. Shortcut menu of object

2. Choose the right indicator

Labview 2009-2010

43

Exercise 2.2 - Customization of displays


Goal
Modify a VI
Topic : Customization with specific models of indicator and messages

Concepts
Free text
Customization of displays

Homework
Open 1_KtoF.vi
Replace numerical indicator with temperature indicator
Insert free text in FP and D to legend them
Save in 2_KtoF.vi
Labview 2009-2010

44

Exercise 2.2 : FP customized

Labview 2009-2010

45

Exercise 2.2 : D customized

Labview 2009-2010

46

Lesson 3
Modular Programming

TOPICS
SubVIs
Icon and Connector Pane
Using SubVIs
Creating a SubVI from sections of a VI
Labview 2009-2010

47

LabVIEW Hierarchy

SubVI

Labview 2009-2010

48

SubVIs
Function Pseudo Code

Calling Program Pseudo Code

function average (in1,


in2, out)
{
out = (in1 + in2)/2.0;
}

main
{
average (point1, point2,
pointavg)
}

SubVI Block Diagram

Calling VI Block Diagram

Labview 2009-2010

49

Icon/Connector
terminals

Icon

An icon represents a VI in other block


diagrams
A connector passes data to and receives
data from a subVI through terminals

Connector

terminals

Labview 2009-2010

50

SubVI Example Conversion temperature


A VI within another VI is called a subVI
To use a VI as a subVI, create an icon and a connector pane after
building the front panel and block diagram

Labview 2009-2010

51

Steps for creating a SubVI


Create the Icon
Create the Connector
Assign Terminals
Save the VI
Insert the VI into a Top Level VI

Labview 2009-2010

52

Creating the Icon


Icon: graphical representation of a VI
Right-click in the icon pane (Panel or Diagram)
Always create a black and white icon
Default Icon

Labview 2009-2010

Create a custom icon

53

Creating the Connector


Right-click the icon
(Front Panel only)

Labview 2009-2010

54

Creating the Connector - continued

Labview 2009-2010

Click with
wiring tool

55

Assign terminals via the Connector Pane


Terminal colors match the data types to which they are connected
Click the terminal to see its associated front panel object

and save the VI !


Labview 2009-2010

56

Using a VI as a SubVI
All Functions Select a VI
<OR>

Drag icon onto target diagram


<OR>

Drag file onto target diagram

Labview 2009-2010

57

Help and Classifying Terminals

Classify inputs and outputs:

Required Error if no connection


Recommended Warning if no connection
Optional No effect if no connection

Labview 2009-2010

58

Exercise 3.1 Generate temperature using SubVI


Goal
Create a simple VI
Topic : convert a Kelvin temperature into Fahrenheit

Concepts
SubVI

Homework
Create icon and connector of 1_KtoF.vi , save it and close
Create a new VI in order to generate a randomly temperature between T0DT et
T0+DT :
2 inputs T0(K) and DTmax(K)
2 outputs T(K) and T(F)
You have to use the VI 1_KtoF.vi
Save in 3_Gen_temp_conv.vi

Labview 2009-2010

59

Searching for Controls, VIs, and Functions


Press the search button to
perform text searches of the
palettes
Click and drag an item from
the search window to the
block diagram or
double-click an item to
open the owning palette

For the exercise, search for Random number


Labview 2009-2010

60

Exercise 3.1 : D

Labview 2009-2010

61

Exercise 3.2 : FP

Labview 2009-2010

62

Complement : another way for creating a subVI

It exists an other way to simply create SubVi.


Indeed, just by selecting the part of the program in which you're interested
in creating a SubVi you can achieve it.
But this method performs some automatic assignments and you will have
to be careful when you use it

Labview 2009-2010

63

Selection of the program part

Labview 2009-2010

64

Creation of the Sub Vi

Labview 2009-2010

65

Terminal assignment & icon

Once the creation is achieved, the selected program part becomes an icon.
You can edit it to customize its appearance.
Moreover, if you look at the terminal assignment, it has automatically be
generated. However, you can change it with the method studied in lesson 2.

Labview 2009-2010

66

Exercise 3.2
Goal
SubVI creation

Homework

Open "3_Gen_temp_conv.vi".
Replace the generation part by a subVI.
Customize the SubVI icon.
Suppress the automatic assignment of "T0" and "dTmax"
Save the SubVI as "3Compl1_Gen_temp_conv.vi"

Labview 2009-2010

67

Summary

VIs can be used as subVIs after you make the icon and connector
Icon created using Icon Editor
Connector defined by choosing number of terminals
Load subVIs using the Select a VI option in the All Functions palette
or dragging the icon onto a new diagram
Online help for subVIs using the Show Context Help option
Descriptions document functionality
Use Create SubVI feature to easily modularize the block diagram

Labview 2009-2010

68

Lesson 4
Simple acquisition

TOPICS
Replacing simulation by acquisition
Data acquisition, acquisition of 1 point

Labview 2009-2010

69

Data Acquisition Hardware (1/2)


Data acquisition (DAQ) basics
Connecting Signals
Simple DAQ application

DAQ Device

Computer

Sensors
Cable
Terminal Block

Labview 2009-2010

70

Data Acquisition Hardware (2/2)


Channel names
Signals

ai 0
ai 1
ai 2

Sine Wave 1
Sine Wave 2
Sine Wave 3

Tasks
Timing and Triggering

Labview 2009-2010

71

Data Acquisition in LabVIEW


Traditional NI-DAQ
Specific VIs for
performing:
Analog Input
Analog Output
Digital I/O
Counter operations

Labview 2009-2010

NI-DAQmx
Next generation driver:
VIs for performing a
task
One set of VIs for all
measurement types

72

Steps for creating and acquisition task


How to create a task to acquire an analogous tension ?

In Diagram, open Palette de fonction


Express > Entres > Assistant DAQ
Acqurir un signal > Entre analogique > Tension

Parameters :
Configuration du terminal : RSE (ground ref.)
Paramtres de cadencement / Mode dacquisition : 1
chantillon sur demande
Labview 2009-2010

73

Exercise 4.1 Simple Data Acquisition


Goal
Acquire analog signal
Topic : acquire voltage from thermistor

Concepts
Assistant acquisition data
and hardware
Formula node

Homework
Step 1 : In a blank vi, create an acquisition task, 1point, tension, -10/+10, RSE
Step 2 : Convert the measured voltage into temperature with formula node or express.
Save it as Acq_Temp.vi
Step 3 : Open the vi Sim_temp_conv2.vi and replace the simulation part (specifications
and generation) by the acquisition part and save it in Acq_Temp_conv.vi
Labview 2009-2010

74

Electronic system

Rth = f(Uth) ?

Vcc
R0
Labview 2009-2010

= +10V
= 10 500 Ohms
75

Ref thermistor :

Labview 2009-2010

76

Exercise 4.1 D

Labview 2009-2010

77

Exercise 4.1 FP

Labview 2009-2010

78

Exercise 4.1 D

With express VIs

With subVI

Labview 2009-2010

79

Exercise 4.1 : Front Panel (FP)

Labview 2009-2010

80

Complement : another way for implementing


mathematical function

For sure, basic mathematical functions for huge calculus won't be very
practical nor very efficient. They lead to complicated programs, and
Labview propose the use of higher level functions like "expression node"
or "formula node"

Labview 2009-2010

81

Exercise 4.2
Goal
Use of higher level function for mathematical calculus
Creation of SubVI

Homework
Open "4_Acq_Temp_conv.vi"
Replace the Calculus part by a "formula node" or an "expression node"
Create a SubVI performing the acquisition and the conversion.
This SubVI won't have any input terminal and just one output terminal.
Save as "4Compl2_Acq_Temp_conv.vi"

Labview 2009-2010

82

Das könnte Ihnen auch gefallen