You are on page 1of 14

WhHe'Luop

- rn Terminal counts .iteraticns

.. ~ '. . . .

AlwaY$ .][1111S: a;t least 'QJl:ce

- Rums uatilstop conditioa i~ met

~

• Par Loop

- rnrernninal ccuntsiterations

,I ...•. _.... ':-..'.:

- Rnnsaceordiag to inputN of" cQU:fi~ terminal lEI

Loops

WhileLOiOp

III

I .-~

I

~- 1'.1]

1. S el ect the structure

2. Enclose code to be repeated

!=...,_ ....... ---!"I .. !!-!!-!!-""'!"' ......... -f!'! !'!--~ ... '!""-""-.oo; ~!!-- ... ""- .... -"""!- ....... !!!!'~-.,..~.'!I"II-!!II-I'!"

,

, ,

, , , ,

-- _. ~------,. _. ----- _ .. ------- .... __ .'._-,_' .. ----Q

3. Drop or drag additional nodes and then wire

I, ~

-'"

--: -

.

How Do I Time a Loop? 1 . Loop Time Delay

iii Oonfigu1e the Time Delay Express VI for seconds to wait each itesarion of the loop (works on for and while loops).

2., Timed Loops

• Configure special timed while loop for desired dt.

m

TimeDelay

Timed Loop

:., Configure Timed Loop ...

Re~lod

11000 ~I ~s·.

Advanc:ecfT:imiQ'Q "",,--------"'"' pl!a.®i ~,

Gi. ~'I

r:~ ~I m ~~

-- - - - - ---

I kHz Clock

J MH< Cloc~

'1, kHz <resetetstructure start> 1 MHo -(reset at structure st(lrt·~ 5ynchronlz9.to 5can Engine

Iypes of Funcrions (from the . Functions Palette

xpress VIs: interactive VIs with configurable dialcgpage (blue Dl'd~r)

.~.

tandard VIs: modularized VIs customized by wiring .ustomizable)

unctions': fundamental operating elements of Lab VIEW; no front

anel orblock.diagram (yellow) Multip]y

~

What Types of Functions AI~e Available?

Input and Output

- Signal and data simularioa

- Rea] signal acquisition 'and generation \vith DAQ

- Iastrument V'O Assistant (Serial and GPm)

- ActiveX for commueication with. oither programs

Analysds

- Signalprocessing _, Statistics

- Advanced, math and formulas

- Continuous time' solver

Storag·e ~ File UO

iHiil~~ .~ ~-o.. .. ~1I.iitt ,~~

~ &<"...."._ ~~ ~.HIII

... ~ ...

'":Il ...if:-'J

- .. ~.~ ~

l ~~jl, ~r:_

1 ,~

I ~ rfaiiYtii

~ Uiiitl.lli;r-.

~oi.n,,, [.,~t~,

l'~~~' ~'!Il~ ,

Express Functions Palette

D~ploymel1lt and edules

[obile Module

:eal·lime Module

PGA Modlile eveloprnebt Module for :W

Iystem Deployment

lItegration Toolkit

test integration. toolkits r D.esign Toolkit

P(3A Modllie

Sigl1llal Processln 9 and Analysis

* Soundand Vibration Toolkit

* Advanced Si~gnal Processing Toolkit *. Modulation Toolkit

•. Spectral Measurem~nts Toolkit

• order Analysis Toolkit

• Dig:ital Filter DeiSign Toolkit

Software Engineerilll,g and Optimization Tools

• Real-Time Execution Trace T oolkit

. .

* Express VI Development T oolkit " State Diag:rClm Toolkit

* VI Analyzer Toolkit

Control Desigl1arnd Simu

• LabVIEW Control Desigr

Simulation Module

• LabVIEW Real·Tin1le MOl •. System :Identification T 01 • Slate Diagram Toolkit

Image Proeesslng and A(

• Visioh Development Mo, LabV~EW

• NI Vision Builder tor Aut, [Inspection

, NI·-'IMlAQ for IEEE 1 .. 394

Searching for Controls, VIs,and Functions

• Palettes arc filled with hundreds of VIs

• Press the search button to index all VIs for text searching

• Click and drag an item fr0111 the search window to the block diagram

• Double-click an item to open the owning palette

_~~~."[I;IJ'II'Pf e. MIlI M ,,"<ern"'rw M!>£ro 1&1

"b"" .......... r""'~" .. UNl __ :MI)I

...,"" sn.;;e r.,..,. J_",""""'" (NlJW'fo.Mb] .

. ~_""".'" rt~I.JMI'roJ",,1 ,"""Elotl_

T_~l!<IS:<voW'ul.Ml>1 <-<SIi7>o!~» T-IJO!t:~'~:s{NI\...~s:Ftj~~] <<W~DI'm~[ T""",II>II,N<d<W_"""'(Nl~.1vIib1

r""" ...... ~,vi(Nl~.MO]

Create Sun V I

• Enclose area to be converted into a sub VI

• Select Ed its-Cre ate Sub"I from the Edit menu

!Slope ... ruse/Run II

ISlope ""Ri5el~un I

abVIEW Functions and SubVIs Operate Lil{e unctions in Other Languages

Function Pseudo Code function average (in l, iin2, out)

{

out = (in] + in2)/2.0; }

Calling Program Pseudo Code maID

{

average (inl , in2, pointavg) }

Su b VI Block Diagram

Calling VI Block Diagram

Charts - Add 1 Data Point at a Time with Historj

Wavefol'm chart - special numeric indicator that can disp lay a history of values

• Chartupdates with each individual point it receives

Controls» E::x:pl'eSS)}Grapb Indicato):'s»Chart

fll!aveformOtllrt!

I~. il----l1'Jj

IE

Tlffie[),~~v ~' .

Graphs - Display Many Data Points at Once

m

c

\Va.veform graph,~ special numeric indieatcrrhar dispLays an array o.f dara

• Gra»h updates after all points have been collected " May be used in, a loop if VI collects buffers of data

rlin ~

m

~ ~~r.,~ ~ .. c_".

'\IVb:at Types of Controls and Indicators AI"e Available?

'Control and Indicator Properties "'P,lI"op!e,rti1es are characteristics or qualities about an object

," Properties can 'be found 'by right-clicking on a. CClIl.1!'Ero[, or indicator

.' Properties include: - Size

- Color

- P~ot style

- Ploreelor

.' Feamres include:

"NIlI,m.e.ll,c nata

- N!lI:mber w:iJlIlit and DLsp'la.y

- Analog S!!id~s, D,ialis, allid 'GSll"lg/es

• B"ooi'ea,n narta

_ Bl.nittons md LEOs

• Arl'a,v and Matrix Data

. . ~. .. . .

Num<enc Dis,play, _ Chan

- Gmpb,

_ XYGrapIJ:

- Intensity Grap'b.

- 3D Grapb: Poin~. :S~fac;e. and Model

• Deem's Hoos _ Tib COlltrol _, Arrows.

.. OUillel"

- Stm,gs md,'TextiBoxi!:5 _ Pid:uwlm'age Display _, Acti!veX Conn:o~s

- Cursors

- Sc,aUng

Express Controls Palette

-",-

IC~

0_·.- ....

-

-._

-,...

£1'_ ",,_

f<l- ...

rj, MI'IlI,~~

File 1/0

File 1110 - passing data to and fromfiles "Files can be binary, text~or spreadsheet

• WI~iteIReadLahV1EW,M!ea.sUFe;ments file (*,lvm)

Wri.tiog to $,lvm file

..

I~'~I

:S-ne' ~, "

Use of File 110 functions

• Openand close data.files

• Read fromand write to. spreadsheet-formatted files

• Move and renamefiles and'directories

",\' , .",' . - .. "':. . '- .. , '. " ..

• Change fllecharaoteristics

• Write-t» or readfrem LahVIEWllieaaui-ernent files

Local Variables

• Local Variables allow data to be passedbetweenperallel loops.

• A single control or indicator can, be read or mitten tofrom more than one location in the program

- Local Variables break the dataflow paradigm and. should be used sparingly

I~

rnJT~21 g;j

II!:ooD ContrOl n L@

~1UmI: ,~

fn:ICoOO'QI

HcIo, c:..uol ~~,~ ~I'O~ tleWdb> oM !'to,,,,

~~l>UCIfI;:

Ado"",~

Local Varia bles,

'1.. Right -cliek the variable and select Chan.ge'Io. Read .. This means that instead of writing data to a local variable, you read data already written h) the variable.

2.. Right .. dick on the stop button on thefront panel andchange themechanical action to Switch When Released ... Local variables-cannot store [atche91 Boolean data,

Creating an Array (Step 1 of 2)

From the Controls»Modern»Arr:ay, Matrix, and Cluster subpalette, select the Array icon.

Drop it on the front panel.

Array

'1.·LI<ie,C:_ lSel!!ct ~ Conti'll!...

Create an Array (Step 2 of 2) 1. Place an array shell.

2.. Insert data type into the shell (i.e, numeric control).

1D Atray View:t.ngJ\rl!tdtipl~ Elemeats;

2U Arra:y Viewing a SingleElement:

PINY

2U Array Viewing MultipleElements:

Array

How Do I Make Decisions in LabVIEW?

1. Case Structures

2. Select

(a)

(b)

Seq uenceStructu res

\ sequence structure contains one or moi ibdiagrams, or frames, that execute

~q uentia I order

~wo types of sequence structures·Flat Sequence structure

·Stacked Sequence structure

Flat Sequence Structures

coce:

Stacked Sequence Structures

sequence local terminal

Stacked Sequence Structures

rTrnl L:J

S,ta~usl :

- ,

Instead use CASE Structure and While Loop!

L [Q]