Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview...

146
LabVIEW TM Core 2 Exercises Course Software Version 2012 August 2012 Edition Part Number 325293D-01 LabVIEW Core 2 Exercises Copyright © 1993–2012 National Instruments. All rights reserved. Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation. National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable license or other legal restriction. End-User License Agreements and Third-Party Legal Notices You can find end-user license agreements (EULAs) and third-party legal notices in the following locations: Notices are located in the <National Instruments>\_Legal Information and <National Instruments> directories. EULAs are located in the <National Instruments>\Shared\MDF\Legal\license directory. Review <National Instruments>\_Legal Information.txt for more information on including legal information in installers built with NI products. Trademarks LabVIEW, National Instruments, NI, ni.com, the National Instruments corporate logo, and the Eagle logo are trademarks of National Instruments Corporation. Refer to the Trademark Information at ni.com/trademarks for other National Instruments trademarks. Other product and company names mentioned herein are trademarks or trade names of their respective companies. Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have no agency, partnership, or joint-venture relationship with National Instruments. Patents For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software, the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents.

Transcript of Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview...

Page 1: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

TM C

ore

2E

xerc

ises

Cou

rse

Sof

twar

e V

ersi

on 2

012

Aug

ust 2

012

Edi

tion

Par

t Num

ber

3252

93D

-01

LabV

IEW

Cor

e 2

Exe

rcis

es

Cop

yrig

ht©

199

3–20

12 N

atio

nal I

nstru

men

ts. A

ll rig

hts r

eser

ved.

U

nder

the

copy

right

law

s, th

is p

ublic

atio

n m

ay n

ot b

e re

prod

uced

or t

rans

mitt

ed in

any

form

, ele

ctro

nic

or m

echa

nica

l, in

clud

ing

phot

ocop

ying

, rec

ordi

ng, s

torin

g in

an

info

rmat

ion

retri

eval

syst

em, o

r tra

nsla

ting,

in w

hole

or i

n pa

rt, w

ithou

t the

prio

r writ

ten

cons

ent o

f Nat

iona

l Ins

trum

ents

Cor

pora

tion.

Nat

iona

l Ins

trum

ents

resp

ects

the

inte

llect

ual p

rope

rty o

f oth

ers,

and

we

ask

our u

sers

to d

o th

e sa

me.

NI s

oftw

are

is p

rote

cted

by

copy

right

and

oth

er in

telle

ctua

l pro

perty

law

s. W

here

NI s

oftw

are

may

be

use

d to

repr

oduc

e so

ftwar

e or

oth

er m

ater

ials

bel

ongi

ng to

oth

ers,

you

may

use

NI s

oftw

are

only

to re

prod

uce

mat

eria

ls th

at y

ou m

ay re

prod

uce

in a

ccor

danc

e w

ith th

e te

rms o

f any

app

licab

le li

cens

e or

oth

er le

gal r

estri

ctio

n.

End

-Use

r Li

cens

e A

gree

men

ts a

nd T

hird

-Par

ty L

egal

Not

ices

You

can

find

end-

user

lice

nse

agre

emen

ts (E

ULA

s) a

nd th

ird-p

arty

lega

l not

ices

in th

e fo

llow

ing

loca

tions

:•

Not

ices

are

loca

ted

in th

e <National Instruments>\_Legal Information

and

<National Instruments>

dire

ctor

ies.

•EU

LAs a

re lo

cate

d in

the <National Instruments>\Shared\MDF\Legal\license

dire

ctor

y.•

Rev

iew

<National Instruments>\_Legal Information.txt

for m

ore

info

rmat

ion

on in

clud

ing

lega

l inf

orm

atio

n in

inst

alle

rs b

uilt

with

NI p

rodu

cts.

Trad

emar

ksLa

bVIE

W, N

atio

nal I

nstru

men

ts, N

I, ni

.com

, the

Nat

iona

l Ins

trum

ents

cor

pora

te lo

go, a

nd th

e Ea

gle

logo

are

trad

emar

ks o

f Nat

iona

l Ins

trum

ents

Cor

pora

tion.

Ref

erto

the

Trad

emar

k In

form

atio

n at

ni.com/trademarks

for o

ther

Nat

iona

l Ins

trum

ents

trad

emar

ks.

Oth

er p

rodu

ct a

nd c

ompa

ny n

ames

men

tione

d he

rein

are

trad

emar

ks o

r tra

de n

ames

of t

heir

resp

ectiv

e co

mpa

nies

. Mem

bers

of t

he N

atio

nal I

nstru

men

ts A

llian

ce P

artn

er P

rogr

am a

re b

usin

ess e

ntiti

es

inde

pend

ent f

rom

Nat

iona

l Ins

trum

ents

and

hav

e no

age

ncy,

par

tner

ship

, or j

oint

-ven

ture

rela

tions

hip

with

Nat

iona

l Ins

trum

ents

.

Pat

ents

For p

aten

ts c

over

ing

Nat

iona

l Ins

trum

ents

pro

duct

s/te

chno

logy

, ref

er to

the

appr

opria

te lo

catio

n: H

elp»

Pate

nts i

n yo

ur so

ftwar

e, th

epatents.txt

file

on

your

med

ia, o

r the

Nat

iona

lIns

trum

ents

Pa

tent

Not

ice

at ni.com/patents

.

Page 2: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Wor

ldw

ide

Tech

nica

l Sup

port

and

Pro

duct

Info

rmat

ion

ni.com

Wor

ldw

ide

Offi

ces

Vis

it ni.com/niglobal

to a

cces

s the

bra

nch

offic

e W

eb si

tes,

whi

ch p

rovi

de u

p-to

-dat

e co

ntac

t inf

orm

atio

n, su

ppor

t pho

ne n

umbe

rs, e

mai

l add

ress

es, a

nd c

urre

nt e

vent

s.

Nat

iona

l Ins

trum

ents

Cor

pora

te H

eadq

uart

ers

1150

0 N

orth

Mop

ac E

xpre

ssw

ayA

ustin

, Tex

as 7

8759

-350

4U

SATe

l: 51

2 68

3 01

00

To c

omm

ent o

n N

atio

nal I

nstru

men

ts d

ocum

enta

tion,

refe

r to

the

Nat

iona

l Ins

trum

ents

Web

site

at ni.com/info

and

ent

er th

e In

fo C

ode feedback

.

Page 3: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|iii

Con

tent

s

Stu

dent

Gui

deA

.N

I Cer

tific

atio

n....

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

vB

.C

ours

e D

escr

iptio

n...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.vi

C.

Wha

t You

Nee

d to

Get

Sta

rted.

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

...vi

D.

Inst

allin

g th

e C

ours

e So

ftwar

e...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.vii

E.C

ours

e G

oals

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.vii

F.C

ours

e C

onve

ntio

ns...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

viii

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wEx

erci

se 1

-1C

once

pt: C

ompa

ring

Que

ues W

ith L

ocal

Var

iabl

es...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.....1

-3Ex

erci

se 1

-2C

once

pt: C

ompa

ring

Even

t Stru

ctur

e D

esig

n w

ith P

ollin

g D

esig

n....

......

......

......

......

......

......

......

......

......

......

......

.....1

-11

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sEx

erci

se 2

-1Si

mpl

e St

ate

Mac

hine

Tem

plat

e....

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

....2

-3Ex

erci

se 2

-2C

once

pt: P

rodu

cer/C

onsu

mer

—Ev

ents

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

...2-

17Ex

erci

se 2

-3C

once

pt: P

rodu

cer/C

onsu

mer

Err

or H

andl

ing.

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

....2

-21

Exer

cise

2-4

His

togr

am...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

....2

-27

Exer

cise

2-5

Use

r Acc

ess L

evel

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.....2

-39

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

Exer

cise

3-1

Dis

play

Tem

pera

ture

and

Lim

its...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

....3

-3Ex

erci

se 3

-2C

usto

miz

ing

the

VI W

indo

w...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

....3

-9Ex

erci

se 3

-3U

sing

Sub

VIs

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.3-1

5

Page 4: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Con

tent

sni

.com

|iv

Less

on 4

File

I/O

Tec

hniq

ues

Exer

cise

4-1

Cre

ate

Fold

er a

nd F

ile...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

...4-

3Ex

erci

se 4

-2W

rite

Mul

tiple

Cha

nnel

s with

Sim

ple

Hea

der..

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

...4-

7Ex

erci

se 4

-3R

ead

TDM

S Fi

les.

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.....4

-13

Less

on 5

Impr

ovin

g an

Exi

stin

g V

IEx

erci

se 5

-1C

once

pt: R

efac

torin

g In

herit

ed C

ode.

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.....5

-1

Less

on 6

Cre

atin

g an

d D

istr

ibut

ing

App

licat

ions

Exer

cise

6-1

APr

epar

ing

File

s for

Dis

tribu

tion

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

...6-

3Ex

erci

se 6

-1B

Cre

atin

g an

d D

ebug

ging

a S

tand

-Alo

ne A

pplic

atio

n...

......

......

......

......

......

......

......

......

......

......

......

......

......

......

......

...6-

7Ex

erci

se 6

-1C

Bui

ldin

g an

Inst

alle

r and

Deb

uggi

ng o

n a

Rem

ote

Mac

hine

......

......

......

......

......

......

......

......

......

......

......

......

......

......

.6-1

1

App

endi

x A

Set

ting

Up

You

r H

ardw

are

Page 5: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|v

Stu

dent

Gui

de

Than

k yo

u fo

r pur

chas

ing

the

LabV

IEW

Cor

e 2

cour

se k

it.Yo

u ca

n be

gin

deve

lopi

ng a

n ap

plic

atio

n so

on a

fter y

ou c

ompl

ete

this

cou

rse.

Thi

s exe

rcis

e m

anua

l and

th

e ac

com

pany

ing

softw

are

are

used

in th

etw

o-da

y, h

ands

-on

LabV

IEW

Cor

e 2

cour

se.

You

can

appl

y th

e fu

ll pu

rcha

se o

f thi

s cou

rse

kit t

owar

d th

e co

rres

pond

ing

cour

se re

gist

ratio

n fe

e if

you

regi

ster

with

in 9

0da

ys o

f pur

chas

ing

the

kit.

Vis

it ni.com/

training

for o

nlin

e co

urse

sche

dule

s, sy

llabi

, tra

inin

g ce

nter

s, an

d cl

ass r

egis

tratio

n.

A.

NI C

ertif

icat

ion

The

LabV

IEW

Cor

e 2

cour

se is

par

t of a

serie

s of c

ours

es d

esig

ned

to b

uild

you

r pro

ficie

ncy

with

Lab

VIE

W a

nd h

elp

you

prep

are

for t

he N

I Cer

tifie

d La

bVIE

W

Ass

ocia

te D

evel

oper

exa

m. T

he fo

llow

ing

illus

tratio

n sh

ows t

he c

ours

es th

at a

re p

art o

f the

Lab

VIE

W tr

aini

ng se

ries.

Ref

er to

ni.com/training

for m

ore

info

rmat

ion

abou

t NIC

ertif

icat

ion.

Adv

ance

d U

ser

LabV

IEW

Cor

e 1*

LabV

IEW

Cor

e 2*

Cer

tifie

d La

bVIE

WA

rchi

tect

Exa

m

New

Use

rE

xper

ienc

ed U

ser

Adv

ance

d A

rchi

tect

ures

in L

abV

IEW

*Cor

e co

urse

s ar

e st

rong

ly r

ecom

men

ded

to r

ealiz

e m

axim

um p

rodu

ctiv

ity g

ains

whe

n us

ing

LabV

IEW

.

Co

urs

es

Cer

tifi

cati

on

s

Oth

er C

ou

rses

Cer

tifie

d La

bVIE

WA

ssoc

iate

Dev

elop

er E

xam

LabV

IEW

Inst

rum

ent C

ontr

ol

Mod

ular

Inst

rum

ents

Ser

ies

LabV

IEW

Rea

l-Tim

e 2

LabV

IEW

FP

GA

LabV

IEW

Rea

l-Tim

e 1

LabV

IEW

DA

Q a

nd S

igna

l Con

ditio

ning

Man

agin

g S

oftw

are

Eng

inee

ring

in L

abV

IEW

LabV

IEW

Per

form

ance

Obj

ect-

Orie

nted

Des

ign

and

Pro

gram

min

gin

Lab

VIE

W

LabV

IEW

Con

nect

ivity

Cer

tifie

d La

bVIE

WD

evel

oper

Exa

m

LabV

IEW

Cor

e 3*

Page 6: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Stu

dent

Gui

deni

.com

|vi

B.

Cou

rse

Des

crip

tion

The L

abVI

EW C

ore 2

cour

se te

ache

s you

pro

gram

min

g co

ncep

ts, t

echn

ique

s, fe

atur

es, V

Is, a

nd fu

nctio

ns y

ou ca

n us

e to

crea

te te

st an

dm

easu

rem

ent,

data

acqu

isiti

on,

inst

rum

ent c

ontro

l, da

talo

ggin

g, m

easu

rem

ent a

naly

sis,

and

repo

rt ge

nera

tion

appl

icat

ions

. Thi

s cou

rse

assu

mes

that

you

are

fam

iliar

with

Win

dow

s; th

at y

ou h

ave

expe

rienc

e w

ritin

g al

gorit

hms i

n th

e fo

rm o

f flo

wch

arts

or b

lock

dia

gram

s; a

nd th

at y

ou h

ave

take

n th

e La

bVIE

W C

ore

1 co

urse

or h

ave

equi

vale

nt e

xper

ienc

e. T

he

cour

se a

nd e

xerc

ise

man

uals

are

div

ided

into

less

ons,

desc

ribed

as f

ollo

ws.

In th

e co

urse

man

ual,

each

less

on c

onsi

sts o

f the

follo

win

g:

•A

n in

trodu

ctio

n th

at d

escr

ibes

the

purp

ose

of th

e le

sson

and

wha

t you

will

lear

n

•A

des

crip

tion

of th

e to

pics

in th

e le

sson

•A

sum

mar

y or

qui

z th

at te

sts a

nd re

info

rces

impo

rtant

con

cept

s and

skill

stau

ght i

n th

ele

sson

In th

e ex

erci

se m

anua

l, ea

ch le

sson

con

sist

s of t

he fo

llow

ing:

•A

set o

f exe

rcis

es to

rein

forc

e th

ose

topi

cs

•So

me

less

ons i

nclu

de o

ptio

nal a

nd c

halle

nge

exer

cise

sect

ions

or a

seto

fadd

ition

al e

xerc

ises

to c

ompl

ete

if tim

e pe

rmits

No

teFo

r cou

rse

and

exer

cise

man

ual u

pdat

es a

nd c

orre

ctio

ns, r

efer

to ni.com/info

and

ent

er th

e In

fo C

ode core2

.

Seve

ral e

xerc

ises

use

a p

lug-

in m

ultif

unct

ion

data

acq

uisi

tion

(DA

Q) d

evic

e co

nnec

ted

to a

DA

Q S

igna

l Acc

esso

ry o

r BN

C 2

120

cont

aini

ng a

tem

pera

ture

sens

or,

func

tion

gene

rato

r, an

d LE

Ds.

If y

ou d

o no

t hav

e th

is h

ardw

are,

you

still

can

com

plet

e th

e ex

erci

ses.

Alte

rnat

e in

stru

ctio

ns a

re p

rovi

ded

for c

ompl

etin

g th

e ex

erci

ses w

ithou

t har

dwar

e. Y

ou a

lso

can

subs

titut

e ot

her h

ardw

are

for t

hose

pre

viou

sly

men

tione

d. F

or e

xam

ple,

you

can

use a

noth

er N

atio

nal I

nstru

men

ts D

AQ

dev

ice

conn

ecte

d to

a si

gnal

sour

ce, s

uch

as a

func

tion

gene

rato

r.

C.

Wha

t You

Nee

d to

Get

Sta

rted

Bef

ore

you

use

this

cou

rse

man

ual,

mak

e su

re y

ou h

ave

all o

f the

follo

win

g ite

ms:

C

ompu

ter r

unni

ng W

indo

ws 7

/Vis

ta/X

P

M

ultif

unct

ion

DA

Q d

evic

e co

nfig

ured

as D

ev1

usin

g M

easu

rem

ent &

Aut

omat

ion

Expl

orer

(MA

X)

D

AQ

Sig

nal A

cces

sory

or B

NC

-212

0, w

ires,

and

cabl

e

Page 7: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|vi

i

La

bVIE

W P

rofe

ssio

nal D

evel

opm

ent S

yste

m 2

012

or la

ter

D

AQ

mx

9.5.

5 or

late

r

La

bVIE

W C

ore

2 co

urse

CD

, fro

m w

hich

you

inst

all t

he fo

llow

ing

fold

ers:

D.

Inst

allin

g th

e C

ours

e S

oftw

are

Com

plet

e th

e fo

llow

ing

step

s to

inst

all t

he c

ours

e so

ftwar

e.

1.In

sert

the

cour

se C

D in

you

r com

pute

r. Th

e L

abV

IEW

Cor

e 2

Cou

rse

Setu

p di

alog

box

app

ears

.

2.C

lick

Inst

all t

he c

ours

e m

ater

ials

.

3.Fo

llow

the

onsc

reen

inst

ruct

ions

to c

ompl

ete

inst

alla

tion

and

setu

p.

Exer

cise

file

s are

loca

ted

in th

e <Exercises>\LabVIEW Core 2\

fold

er.

No

teFo

lder

nam

es in

ang

le b

rack

ets,

such

as <

Exercises>

, ref

er to

fold

ers o

n th

e ro

ot d

irect

ory

of y

our c

ompu

ter.

E.

Cou

rse

Goa

ls

This

cou

rse

prep

ares

you

to d

o th

e fo

llow

ing:

•A

pply

com

mon

des

ign

patte

rns t

hat u

se q

ueue

s and

eve

nts

•U

se e

vent

pro

gram

min

g ef

fect

ivel

y

•Pr

ogra

mm

atic

ally

con

trol u

ser i

nter

face

obj

ects

•Ev

alua

te fi

le I/

O fo

rmat

s and

use

them

in a

pplic

atio

ns

•M

odify

exi

stin

g co

de fo

r im

prov

ed u

sabi

lity

Dir

ecto

ryD

escr

ipti

on

Exercises

Con

tain

s VIs

use

d in

the

cour

se

Solutions

Con

tain

s com

plet

ed c

ours

e ex

erci

ses

Page 8: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Stu

dent

Gui

deni

.com

|vi

ii

•Pr

epar

e, b

uild

, deb

ug, a

nd d

eplo

y st

and-

alon

e ap

plic

atio

ns

This

cou

rse

does

not

des

crib

e an

y of

the

follo

win

g:

•La

bVIE

W p

rogr

amm

ing

met

hods

cov

ered

in th

e La

bVIE

W C

ore

1 co

urse

•Ev

ery

built

-in V

I, fu

nctio

n, o

r obj

ect;

refe

r to

the

LabV

IEW

Hel

p fo

r mor

e in

form

atio

n ab

out L

abV

IEW

feat

ures

not

des

crib

ed in

this

cou

rse

•D

evel

opin

g a

com

plet

e ap

plic

atio

n fo

r any

stud

ent i

n th

e cl

ass;

refe

r to

the

NI E

xam

ple

Find

er, a

vaila

ble

by se

lect

ing

Hel

p»Fi

nd E

xam

ples

, for

exa

mpl

e V

Is

you

can

use

and

inco

rpor

ate

into

VIs

you

cre

ate

F.C

ours

e C

onve

ntio

ns

The

follo

win

g co

nven

tions

app

ear i

n th

is c

ours

e m

anua

l:

»Th

e »

sym

bol l

eads

you

thro

ugh

nest

ed m

enu

item

s and

dia

log

box

optio

nsto

a fi

nal a

ctio

n. T

he se

quen

ce T

ools

»Ins

trum

enta

tion»

Find

Inst

rum

ent D

rive

rs d

irect

s you

to d

rop

dow

n th

e T

ools

men

u, se

lect

the

Inst

rum

enta

tion

item

, and

fina

lly se

lect

the

Find

In

stru

men

t Dri

vers

opt

ion.

This

icon

den

otes

a ti

p, w

hich

ale

rts y

ou to

adv

isor

y in

form

atio

n.

This

icon

den

otes

a n

ote,

whi

ch a

lerts

you

to im

porta

nt in

form

atio

n.

This

icon

den

otes

a c

autio

n, w

hich

adv

ises

you

of p

reca

utio

ns to

take

to a

void

inju

ry, d

ata

loss

, or a

syst

em c

rash

.

This

icon

indi

cate

s tha

t an

exer

cise

requ

ires a

plu

g-in

DA

Q d

evic

e.

bold

Bol

d te

xt d

enot

es it

ems t

hat y

ou m

ust s

elec

t or c

lick

in th

e so

ftwar

e, su

ch a

s men

u ite

ms a

nd d

ialo

g bo

x op

tions

. Bol

d te

xt a

lso

deno

tes s

ectio

ns o

f dia

log

boxe

s and

har

dwar

e la

bels

.

italic

Italic

text

den

otes

var

iabl

es, e

mph

asis

, a c

ross

-ref

eren

ce, o

r an

intro

duct

ion

to a

key

con

cept

. Ita

lic te

xt a

lso

deno

tes t

ext t

hat i

s a

plac

ehol

der f

or a

wor

d or

val

ue th

at y

ou m

ust s

uppl

y.

monospace

Text

in th

is fo

nt d

enot

es te

xt o

r cha

ract

ers t

hat y

ou sh

ould

ent

er fr

om th

e ke

yboa

rd, s

ectio

ns o

f cod

e, p

rogr

amm

ing

exam

ples

, and

sy

ntax

exa

mpl

es. T

his f

ont i

s als

o us

ed fo

r the

pro

per n

ames

of d

isk

driv

es, p

aths

, dire

ctor

ies,

prog

ram

s, su

bpro

gram

s, su

brou

tines

, de

vice

nam

es, f

unct

ions

, ope

ratio

ns, v

aria

bles

, file

nam

es, a

nd e

xten

sion

s.

monospace bold

Bol

d te

xt in

this

font

den

otes

the

mes

sage

s and

resp

onse

s tha

t the

com

pute

r aut

omat

ical

ly p

rints

to th

e sc

reen

. Thi

s fon

t als

o em

phas

izes

line

s of c

ode

that

are

diff

eren

t fro

m th

e ot

her e

xam

ples

.

Page 9: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|

1-11

Mov

ing

Bey

ond

Dat

aflo

w

Exe

rcis

esEx

erci

se 1

-1C

once

pt: C

ompa

ring

Que

ues W

ith L

ocal

Var

iabl

esEx

erci

se 1

-2C

once

pt: C

ompa

ring

Even

t Stru

ctur

e D

esig

n w

ith P

ollin

g D

esig

n

Page 10: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 11: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

3

Exe

rcis

e 1-

1C

once

pt: C

ompa

ring

Que

ues

With

Loc

al V

aria

bles

Goa

lIn

this

exe

rcis

e, y

ou ru

n an

d ex

amin

e a

preb

uilt

prod

ucer

/con

sum

er d

esig

n pa

ttern

VI t

hat t

rans

fers

dat

a th

at a

pro

duce

r loo

p ge

nera

tes t

o co

nsum

er lo

ops u

sing

loca

l va

riabl

es a

nd q

ueue

s.

Des

crip

tion

The

follo

win

g se

ctio

ns d

escr

ibe

how

the

Que

ues v

s Loc

al V

aria

bles

VI d

oes t

he fo

llow

ing.

•C

reat

es a

que

ue.

•Q

ueue

s dat

a th

at th

e pr

oduc

er lo

op g

ener

ates

.

•D

eque

ues d

ata

in th

e co

nsum

er lo

op.

•W

aits

for t

he q

ueue

to e

mpt

y be

fore

exi

ting

the

VI.

•U

ses l

ocal

var

iabl

es to

read

and

dis

play

dat

a fr

om th

e pr

oduc

er lo

op.

Page 12: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

4

1.O

pen Queues vs Local Variables.lvproj

in th

e <Exercises>\LabVIEW Core 2\Queues versus Local Variables

dire

ctor

y.

2.D

oubl

e-cl

ick

Que

ues v

s Loc

al V

aria

bles

.vi i

n th

e Pr

ojec

t Exp

lore

r w

indo

w to

ope

n th

e V

I. Th

e fr

ont p

anel

of t

his V

I is s

how

n in

Fig

ure

1-1.

Fig

ure

1-1

. Fr

ont P

anel

of t

he Q

ueue

s vs

Loc

al V

aria

bles

VI

3.R

un th

e V

I. Th

e Pr

oduc

er L

oop

gene

rate

s dat

a an

d tra

nsfe

rs it

to e

ach

cons

umer

loop

usi

ng a

loca

l var

iabl

e an

d a

queu

e. O

bser

ve th

e be

havi

or o

f the

VI w

hen

the

cons

umer

loop

s are

set t

o th

e sa

me

spee

d as

the

prod

ucer

loop

.

4.St

op th

e V

I.

Page 13: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

5

5.D

ispl

ay a

nd e

xam

ine

the

bloc

k di

agra

m fo

r thi

s VI.

The

follo

win

g se

ctio

ns d

escr

ibe

parts

of t

his b

lock

dia

gram

in m

ore

deta

il.

Fig

ure

1-2

. B

lock

Dia

gram

of t

he Q

ueue

s vs

Loc

al V

aria

bles

VI

Page 14: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

6

Cre

atin

g a

Que

ueYo

u cr

eate

the

queu

e w

ith c

ode

show

n in

Fig

ure

1-3.

Thi

s cod

e is

loca

ted

to th

e le

ft of

the

prod

ucer

loop

.

Fig

ure

1-3

. C

reat

ing

the

Que

ue

Que

uing

Dat

a G

ener

ated

by

the

Pro

duce

r Lo

op

Fig

ure

1-4

. Q

ueui

ng D

ata

the

Pro

duce

r Lo

op G

ener

ates

1M

ax q

ueue

siz

e—S

ets

the

max

imum

num

ber

of e

lem

ents

that

the

queu

e ca

n ho

ld.

2D

ata

Typ

e nu

mer

ic c

onst

ant—

Wire

d to

the

elem

ent d

ata

typ

e in

put o

f the

Obt

ain

Que

ue fu

nctio

n, s

peci

fies

the

type

of d

ata

that

you

wan

t the

que

ue to

con

tain

.

3O

btai

n Q

ueue

—C

reat

es th

e qu

eue

and

defin

es th

e da

ta ty

pe.

1E

nque

ue E

lem

ent—

Add

s ea

ch d

ata

elem

ent t

he G

ener

ate

Sin

e V

I gen

erat

es in

the

Pro

duce

r Lo

op to

the

back

of t

he q

ueue

.

1 2

3

1

Page 15: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

7

Deq

ueui

ng D

ata

from

the

Pro

duce

r Lo

op in

side

the

Que

ue C

onsu

mer

Loo

p

Fig

ure

1-5

. D

eque

uing

Dat

a in

side

the

Con

sum

er L

oop

1D

eque

ue E

lem

ent—

Rem

oves

an

elem

ent f

rom

the

fron

t of t

he q

ueue

and

sen

ds th

e da

ta e

lem

ent t

o th

e Q

ueue

Con

sum

er L

oop

wav

efor

m c

hart

.

2G

et Q

ueue

Sta

tus—

Indi

cate

s ho

w m

any

elem

ents

rem

ain

in th

e qu

eue.

In o

rder

to p

roce

ss th

ese

data

ele

men

ts, y

ou m

ust e

xecu

te th

e Q

ueue

Con

sum

er L

oop

fast

er th

an th

e P

rodu

cer

Loop

, or

cont

inue

to p

roce

ss a

fter

the

Pro

duce

r Lo

op s

tops

.

12

Page 16: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

8

Wai

ting

for

the

Que

ue to

Em

pty

Fig

ure

1-6

. W

aitin

g fo

r th

e Q

ueue

to E

mpt

y

1W

hile

Loo

p—W

aits

for

the

queu

e to

em

pty

befo

re s

topp

ing

the

VI.

Ref

er to

this

Whi

le L

oop

as th

e Q

ueue

Wai

t Loo

p.

2G

et Q

ueue

Sta

tus—

Ret

urns

info

rmat

ion

abou

t the

cur

rent

sta

te o

f the

que

ue, s

uch

as th

e nu

mbe

r of

dat

a el

emen

ts c

urre

ntly

in th

e qu

eue.

3E

qual

To

0?—

Wire

d to

the

stop

con

ditio

n of

the

Que

ue W

ait L

oop

chec

ks if

the

queu

e is

em

pty.

4R

elea

se Q

ueue

—R

elea

ses

and

clea

rs r

efer

ence

s to

the

queu

e.

5S

impl

e E

rror

Han

dler

—R

epor

ts a

ny e

rror

at t

he e

nd o

f exe

cutio

n.

2 31

5

4

Page 17: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

9

Loca

l Var

iabl

e C

onsu

mer

Loo

pTh

e Pr

oduc

er L

oop

also

writ

es th

e ge

nera

ted

sine

wav

e da

ta to

a lo

cal v

aria

ble

whi

le th

e Lo

cal V

aria

ble

Con

sum

er L

oop

perio

dica

lly re

ads o

ut th

e si

ne w

ave

data

fr

om th

e sa

me

loca

l var

iabl

e.

Fig

ure

1-7

. Lo

cal V

aria

ble

Con

sum

er L

oop

Test

Loca

l Var

iabl

e C

onsu

mer

Loo

p1.

Switc

h to

the

fron

t pan

el o

f the

Que

ues v

s Loc

al V

aria

bles

VI.

2.R

un th

e V

I.

3.Se

lect

diff

eren

t spe

eds f

or th

e Lo

cal V

aria

ble

Con

sum

er L

oop

and

obse

rve

the

Loca

l Var

iabl

e C

onsu

mer

Loo

p ch

art a

nd th

e re

sults

gen

erat

ed o

n th

e M

issi

ng

Sam

ples

indi

cato

r or D

uplic

ated

Sam

ples

indi

cato

r.

En

sure

that

the

Loo

p Sp

eed

sele

cted

is S

ame

as P

rodu

cer

Loo

p an

d ob

serv

e th

e Pr

oduc

er L

oop

char

t and

the

Loca

l Var

iabl

e C

onsu

mer

Loo

p ch

art.

A ra

ce

cond

ition

may

occ

ur re

sulti

ng in

mis

sed

poin

ts o

r dup

licat

ed d

ata.

Se

lect

2x

from

the

pull-

dow

n m

enu

of th

e L

oop

Spee

d co

ntro

l and

obs

erve

the

Loca

l Var

iabl

e C

onsu

mer

Loo

p ch

art.

A ra

ce c

ondi

tion

occu

rs b

ecau

se d

ata

is c

onsu

med

fast

er th

an it

is p

rodu

ced,

allo

win

g th

e lo

cal v

aria

ble

to re

ad th

e sa

me

valu

e m

ultip

le ti

mes

.

1U

pdat

e C

ount

ers—

Upd

ates

the

coun

ters

for

mis

sed

or d

uplic

ated

sam

ples

.

1

Page 18: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

10

Se

lect

1/2

as P

rodu

cer

from

the

pull-

dow

n m

enu

of th

e L

oop

Spee

d co

ntro

l and

obs

erve

the

Loca

l Var

iabl

e C

onsu

mer

Loo

p ch

art.

A ra

ce c

ondi

tion

occu

rs

beca

use

data

is p

rodu

ced

fast

er th

an it

is c

onsu

med

. The

dat

a ch

ange

s bef

ore

the

loca

l var

iabl

e ha

s a c

hanc

e to

read

it.

Se

lect

the

rem

aini

ng o

ptio

ns a

vaila

ble

from

the

pull-

dow

n m

enu

of th

e L

oop

Spee

d co

ntro

l and

obs

erve

the

data

retri

eval

.

4.St

op th

e V

I.

Dat

a tra

nsfe

r bet

wee

n tw

o no

n-sy

nchr

oniz

ed p

aral

lel l

oops

usi

ng lo

cal v

aria

bles

cau

ses a

race

con

ditio

n. T

his o

ccur

s whe

n th

e Pr

oduc

er L

oop

is w

ritin

g a

valu

e to

a lo

cal v

aria

ble

whi

le th

e Lo

cal V

aria

ble

Con

sum

er L

oop

is p

erio

dica

lly re

adin

g ou

t the

val

ue fr

om th

e sa

me

loca

l var

iabl

e. B

ecau

se th

e pa

ralle

l loo

ps a

re n

ot

sync

hron

ized

, the

val

ue c

an b

e w

ritte

n be

fore

it h

as a

ctua

lly b

een

read

or v

ice

vers

a re

sulti

ng in

dat

a st

arva

tion

or d

ata

over

flow

.

Que

ue C

onsu

mer

Loo

p1.

Run

the

VI.

2.Se

lect

the

loop

tim

e sp

eed

of th

e Q

ueue

Con

sum

er L

oop

and

obse

rve

the

Que

ue C

onsu

mer

Loo

p w

avef

orm

cha

rt an

d th

e re

sults

gen

erat

ed o

n th

e Sa

mpl

es in

Q

ueue

indi

cato

r.

En

sure

that

the

Loo

p Sp

eed

sele

cted

is S

ame

as P

rodu

cer

and

obse

rve

the

valu

e of

the

Sam

ples

in Q

ueue

indi

cato

r. Th

e va

lue

shou

ld re

mai

n ze

ro. H

ence

w

ith q

ueue

s, yo

u w

ill n

ot lo

se d

ata

whe

n th

e pr

oduc

er a

nd c

onsu

mer

loop

s are

exe

cutin

g at

the

sam

e ra

te.

Se

lect

2x

from

the

pull-

dow

n m

enu

of th

e L

oop

Spee

d co

ntro

l and

obs

erve

the

valu

e of

the

Sam

ples

in Q

ueue

indi

cato

r. Th

e va

lue

shou

ld re

mai

n ze

ro.

Hen

ce w

ith q

ueue

s, yo

u w

ill n

ot lo

se d

ata

if th

e co

nsum

er lo

op is

exe

cutin

g m

uch

fast

er th

an th

e pr

oduc

er lo

op.

Se

lect

1/2

as P

rodu

cer

from

the

pull-

dow

n m

enu

of th

e L

oop

Spee

d co

ntro

l and

obs

erve

the

valu

e of

the

Sam

ples

in Q

ueue

indi

cato

r. Th

e da

ta p

oint

s ac

cum

ulat

e in

the

queu

e. Y

ou n

eed

to p

roce

ss th

e ac

cum

ulat

ed e

lem

ents

in th

e qu

eue

befo

re re

achi

ng th

e m

axim

um si

ze o

f the

que

ue to

avo

id d

ata

loss

.

Se

lect

the

rem

aini

ng o

ptio

ns a

vaila

ble

from

the

pull-

dow

n m

enu

of th

e L

oop

Spee

d co

ntro

l and

obs

erve

the

sync

hron

izat

ion

of d

ata

trans

fer b

etw

een

the

prod

ucer

loop

and

the

cons

umer

loop

usi

ng q

ueue

s.

3.St

op th

e V

I.

Whe

n th

e Pro

duce

r Loo

p an

d Q

ueue

Con

sum

er L

oop

run

at th

e sam

e spe

ed, t

he n

umbe

r of e

lem

ents

in th

e que

ue re

mai

ns u

ncha

nged

. Whe

n th

e Que

ue C

onsu

mer

Lo

op ru

ns sl

ower

, the

que

ue q

uick

ly b

acks

up

and

the

Prod

ucer

Loo

p m

ust w

ait f

or th

e Q

ueue

Con

sum

er L

oop

to re

mov

e th

e el

emen

ts. W

hen

the

Que

ue

Con

sum

er L

oop

runs

fast

er, t

hequ

eue

quic

kly

empt

ies a

nd th

e co

nsum

er lo

op m

ust w

ait f

or th

e Pr

oduc

er lo

op to

inse

rt el

emen

ts. H

ence

que

ues s

ynch

roni

ze th

e da

ta tr

ansf

er b

etw

een

the

two

inde

pend

ent p

aral

lel l

oops

and

thus

avo

id lo

ss o

r dup

licat

ion

of d

ata.

4.C

lose

the

VI.

Do

not s

ave

chan

ges.

End

of E

xerc

ise

1-1

Page 19: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

11

Exe

rcis

e 1-

2C

once

pt: C

ompa

ring

Eve

nt S

truc

ture

Des

ign

with

Pol

ling

Des

ign

Goa

lTo

con

vert

a po

lling

-bas

ed a

pplic

atio

n to

an

even

t-bas

ed a

pplic

atio

n

Des

crip

tion

Firs

t you

obs

erve

the

beha

vior

of a

pol

ling

VI.

Nex

t, yo

u m

odify

the

polli

ng V

I to

crea

te a

mor

e ef

ficie

nt, e

vent

-driv

en V

I and

obs

erve

the

chan

ges i

n be

havi

or.

Fina

lly, y

ou a

dd d

iffer

ent t

ypes

of e

vent

s to

the

VI.

Tabl

e1-

1 lis

ts th

e ev

ents

you

will

impl

emen

t in

the

UI E

vent

Han

dler

VI y

ou c

reat

e.

Obs

ervi

ng th

e P

ollin

g V

I Beh

avio

r1.

Ope

n an

d ru

n Po

lling

.vi.

O

pen

the Events.lvproj

file

in th

e <Exercises>\LabVIEW Core 2\Events

dire

ctor

y an

d op

en th

e Po

lling

VI f

rom

the

proj

ect.

2.Ex

amin

e th

e pe

rfor

man

ce o

f a p

ollin

g V

I usi

ng th

e W

indo

ws T

ask

Man

ager

.

Pr

ess t

he <

Ctrl

-Alt-

Del

ete>

key

s and

sele

ct S

tart

Tas

k M

anag

er fr

om th

e m

enu.

C

lick

the

Perf

orm

ance

tab

in th

e W

indo

ws T

ask

Man

ager

win

dow

.

Tab

le 1

-1.

Use

r In

terfa

ce E

vent

s

Eve

nt

Eve

nt

Des

crip

tio

n

“Sto

p”: V

alue

Cha

nge

Stop

s the

Whi

le L

oop.

“Tim

e C

heck

”: V

alue

Cha

nge

Dis

play

s a ti

me

stam

p w

hen

you

clic

k th

e T

ime

Che

ck b

utto

n.

“Pan

e”: M

ouse

Dow

nD

ispl

ays t

he c

oord

inat

es o

f the

fron

t pan

el p

oint

you

clic

k.

Pane

l Clo

se?

Han

dles

the

even

t in

whi

ch th

e us

er tr

ies t

o cl

ose

the

runn

ing

VI b

y cl

icki

ng th

e w

indo

w c

lose

but

ton.

“Sto

p”: M

ouse

Ent

erPr

oduc

es a

bee

p w

hen

the

mou

se c

urso

r mov

es o

ver t

he S

top

butto

n.

Page 20: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

12

R

un th

e V

I.

N

otic

e ho

w h

igh

the

CPU

usa

ge is

.

St

op th

e V

I and

not

ice

how

the

CPU

usa

ge d

rops

.

3.O

pen

the

bloc

k di

agra

m, t

urn

on e

xecu

tion

high

light

ing,

and

run

the

VI a

gain

.

4.N

otic

e ho

w o

ften

the

Tim

e C

heck

term

inal

send

s dat

a to

the

Cas

e st

ruct

ure

and

how

ofte

n th

e W

hile

Loo

p ite

rate

s.

5.St

op th

e V

I and

turn

off

exe

cutio

n hi

ghlig

htin

g.

Mod

ifyin

g th

e P

ollin

g V

I to

Use

Eve

nts

Inst

ead

of P

ollin

g1.

Save

the

VI a

s UI Event Handler.vi

so y

ou c

an m

odify

it.

Se

lect

Ope

n ad

ditio

nal c

opy

and

add

the

copy

to th

e pr

ojec

t.

2.C

lose

Pol

ling.

vi.

3.O

pen

the

bloc

k di

agra

m o

f Eve

nts.v

i and

mov

e th

e St

op te

rmin

al a

nd th

e Ti

me

Che

ck te

rmin

al o

utsi

de th

e W

hile

Loo

p. Y

ou m

ove

thes

e te

rmin

als i

nto

the

appr

opria

te e

vent

cas

es la

ter i

n th

is e

xerc

ise.

4.D

elet

e th

e C

ase

stru

ctur

e an

d cl

ean

up a

ny b

roke

n w

ires.

5.Pl

ace

an E

vent

stru

ctur

e in

side

the

Whi

le L

oop

betw

een

the

itera

tion

term

inal

and

the

cond

ition

al te

rmin

al.

6.R

ight

-clic

k th

e Ev

ent s

truct

ure

and

sele

ct E

dit E

vent

s Han

dled

by

Thi

s Cas

e fr

om th

e sh

ortc

ut m

enu.

Page 21: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

13

7.C

onfig

ure

the

even

t as s

how

n in

Fig

ure

1-8.

Fig

ure

1-8

. C

onfig

urin

g th

e "S

top"

: Val

ue C

hang

e E

vent

8.C

lick

OK

to c

lose

the

dial

og b

ox.

1C

lick

Sto

p in

the

Eve

nt

So

urc

es p

anel

.

2C

lick

Val

ue

Ch

ang

e in

the

Eve

nts

pan

el.

12

Page 22: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

14

9.Pl

ace

a Tr

ue c

onst

ant i

nsid

e th

e ne

w "

Stop

": V

alue

Cha

nge

even

t and

wire

it to

the

cond

ition

al te

rmin

al o

f the

Whi

le L

oop

as sh

own

in F

igur

e1-

9.

Fig

ure

1-9

. E

vent

Str

uctu

re w

ith "

Sto

p": V

alue

Cha

nge

Eve

nt

Obs

ervi

ng th

e B

ehav

ior

of th

e E

vent

-Driv

en V

I1.

Run

the

VI.

2.N

otic

e th

at th

e It

erat

ion

indi

cato

r doe

s not

incr

emen

t.

3.Sw

itch

to th

e bl

ock

diag

ram

and

ena

ble

exec

utio

n hi

ghlig

htin

g.

4.N

otic

e th

at th

e W

hile

Loo

p is

exe

cutin

g th

e fir

st it

erat

ion.

The

Eve

nt st

ruct

ure

is w

aitin

g fo

r an

even

t.

5.D

isab

le e

xecu

tion

high

light

ing

and

switc

h ba

ck to

the

fron

t pan

el.

6.C

lick

the

Stop

but

ton

to st

op th

e V

I.

7.N

otic

e th

at th

e V

I sto

ps ru

nnin

g ev

en th

ough

the

Stop

but

ton

is d

isco

nnec

ted.

8.N

otic

e th

at th

e St

op b

utto

n st

ays d

epre

ssed

eve

n th

ough

the

mec

hani

cal a

ctio

n is

set t

o L

atch

Whe

n R

elea

sed.

The

reas

on th

e bu

tton

stay

s dep

ress

ed is

bec

ause

th

e V

I sto

pped

runn

ing

afte

r you

clic

ked

the

butto

n.

1N

ewV

al e

vent

dat

a—R

esiz

e th

e ev

ent d

ata

item

s lis

t so

that

onl

y on

e ite

m d

ispl

ays.

Clic

k th

e ite

m a

nd s

elec

t New

Val

.

1

Page 23: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

15

9.R

eset

the

Stop

but

ton

by c

licki

ng it

aga

in.

10.D

rag

the

term

inal

of t

he S

top

butto

n in

to th

e "S

top"

: Val

ue C

hang

e ev

ent a

s sho

wn

in F

igur

e1-

10.

Fig

ure

1-1

0. "

Sto

p": V

alue

Cha

nge

Eve

nt w

ith S

top

But

ton

Term

inal

11.R

un th

e V

I and

clic

k th

e St

op b

utto

n ag

ain.

12.N

otic

e th

is ti

me

the

VI s

tops

and

the

butto

n re

sets

.

Page 24: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

16

Pro

gram

min

g th

e "T

ime

Che

ck":

Val

ue C

hang

e E

vent

1.A

dd a

new

eve

nt c

ase

and

crea

te a

“Ti

me

Che

ck”:

Val

ue C

hang

e ev

ent a

s sho

wn

in F

igur

e1-

11.

R

ight

-clic

k th

e ev

ent s

truct

ure

and

sele

ct A

dd E

vent

Cas

e.

Fig

ure

1-1

1. E

vent

Str

uctu

re w

ith "

Tim

e C

heck

": V

alue

Cha

nge

Eve

nt

2.R

un th

e V

I.

3.C

lick

the

Tim

e C

heck

but

ton

to se

e th

e cu

rren

t tim

e di

spla

y in

the

curr

ent t

ime

indi

cato

r.

4.D

ispl

ay th

e Ta

sk M

anag

er w

indo

w a

nd n

otic

e th

at C

PU u

sage

has

dec

reas

ed w

hen

you

use

even

ts in

stea

d of

pol

ling.

5.St

op th

e V

I.

1In

the

Ed

it E

ven

ts w

indo

w, s

elec

t Tim

e C

hec

k in

the

Eve

nt

So

urc

es p

anel

and

Val

ue

Ch

ang

e in

the

Eve

nts

pan

el.

2M

ove

the

Tim

e C

heck

term

inal

from

out

side

the

Whi

le L

oop

into

the

"Tim

e C

heck

": V

alue

Cha

nge

even

t cas

e.

3G

et D

ate/

Tim

e In

Sec

onds

—C

reat

es a

tim

e st

amp

in m

emor

y.

4In

dica

tor—

Dis

play

s th

e cu

rren

t ti

me

outp

ut o

f the

Get

Dat

e/T

ime

In S

econ

ds fu

nctio

n.

2 31 43

Page 25: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

17

Add

ing

Mor

e N

otifi

er E

vent

s to

the

VI

1.A

dd a

new

eve

nt c

ase

and

crea

te a

Mou

se D

own

even

t as s

how

n in

Fig

ure

1-12

.

Fig

ure

1-1

2. E

vent

Str

uctu

re w

ith "

Pan

e": M

ouse

Dow

n E

vent

2.R

un th

e V

I.

3.C

lick

on d

iffer

ent p

arts

of t

he fr

ont p

anel

.

N

otic

e th

at th

e C

oord

s ind

icat

or d

ispl

ays t

he c

oord

inat

es fo

r eac

h po

int y

ou c

lick.

N

otic

e th

at th

e ot

her e

vent

s con

tinue

to b

ehav

e as

bef

ore.

4.St

op th

e V

I.

1In

the

Ed

it E

ven

ts w

indo

w, s

elec

t Pan

es»P

ane

in th

e E

ven

t S

ou

rces

pan

el a

nd M

ou

se»M

ou

se D

ow

n in

the

Eve

nts

pan

el.

2C

oord

s ev

ent d

ata—

Clic

k th

e ev

ent d

ata

node

and

sel

ect C

oo

rds»

All

Ele

men

ts.

3C

oord

s in

dica

tor—

Rig

ht-c

lick

the

outp

ut o

f the

Co

ord

s ev

ent d

ata

item

and

sel

ect C

reat

e»In

dic

ato

r fr

om th

e sh

ortc

ut m

enu.

1 32

Page 26: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 1

Mov

ing

Bey

ond

Dat

aflo

wni

.com

|1-

18

Add

ing

Filt

er E

vent

s to

the

VI

1.A

dd a

new

eve

nt c

ase

and

crea

te a

Pan

el C

lose

? ev

ent a

s sho

wn

in F

igur

e1-

13.

Fig

ure

1-1

3. E

vent

Str

uctu

re w

ith P

anel

Clo

se?

Eve

nt

2.Sa

ve a

nd ru

n th

e V

I.

3.C

lick

the

“X”

at th

e to

p-rig

ht o

f the

win

dow

of t

he fr

ont p

anel

.

4.N

otic

e th

at c

licki

ng th

e N

o bu

tton

canc

els t

he e

vent

and

retu

rns t

o th

e V

I.

5.C

licki

ng th

e Y

es b

utto

n st

ops a

nd c

lose

s the

VI.

6.St

op th

e V

I if n

eces

sary

.

1A

fter

you

add

the

even

t, in

the

Ed

it E

ven

ts w

indo

w, s

elec

t <T

his

VI>

in th

e E

ven

t S

ou

rces

pan

el a

nd P

anel

Clo

se?

in th

e E

ven

ts p

anel

.

2E

vent

dat

a no

de—

Clic

k th

e E

vent

Dat

a N

ode

and

sele

ct S

ou

rce

from

the

men

u.

3T

wo

But

ton

Dia

log

func

tion

and

Not

func

tion—

Wire

the

T b

utt

on

? o

utpu

t to

the

Not

func

tion

and

wire

the

Not

func

tion

to th

e D

isca

rd?

even

t filt

er n

ode.

4S

trin

g co

nsta

nt—

Wire

Are

yo

u s

ure

yo

u w

ant

to c

lose

th

e w

ind

ow

? to

the

mes

sag

e in

put.

5Y

es a

nd N

o st

ring

cons

tant

s—W

ire Y

es to

the

T b

utt

on

nam

e ("

OK

") in

put a

nd w

ire N

o to

the

F b

utt

on

nam

e ("

Can

cel"

) in

put.

1 3 2

4 5

Page 27: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|1-

19

Cha

lleng

e1.

If y

ou h

ave

a so

und

card

, add

an

even

t tha

t pro

duce

s a so

und

whe

n th

e cu

rsor

is o

ver t

he S

top

butto

n.

Tip

Use

Qui

ck D

rop

to fi

nd th

e Beep.vi

.

End

of E

xerc

ise

1-2

Page 28: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 29: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|

2-12

Impl

emen

ting

Des

ign

Pat

tern

s

Exe

rcis

esEx

erci

se 2

-1Si

mpl

e St

ate

Mac

hine

Tem

plat

eEx

erci

se 2

-2C

once

pt: P

rodu

cer/C

onsu

mer

—Ev

ents

Exer

cise

2-3

Con

cept

: Pro

duce

r/Con

sum

er E

rror

Han

dlin

gEx

erci

se 2

-4H

isto

gram

Exer

cise

2-5

Use

r Acc

ess L

evel

Page 30: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 31: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

3

Exe

rcis

e 2-

1S

impl

e S

tate

Mac

hine

Tem

plat

e

Goa

lU

se th

e Si

mpl

e St

ate

Mac

hine

tem

plat

e in

Lab

VIE

W to

cre

ate

an a

pplic

atio

n in

whi

ch u

sers

con

trol t

he a

cqui

sitio

n an

d sa

ving

of w

avef

orm

dat

a.

Sce

nario

You

wan

t to

use

an e

vent

-bas

ed st

ate

mac

hine

des

ign

to b

uild

a ro

bust

app

licat

ion

that

acq

uire

s and

save

s wav

efor

m d

ata.

You

beg

in w

ith th

e Si

mpl

e St

ate

Mac

hine

te

mpl

ate,

whi

ch p

rovi

des a

Lab

VIE

W p

roje

ct fi

le a

nd a

ll th

e su

ppor

ting

VIs

and

type

def

initi

on c

ontro

ls y

ou n

eed

to c

reat

e an

eve

nt-b

ased

stat

e m

achi

ne a

pplic

atio

n.

Des

ign

The

Sim

ple

Stat

e M

achi

ne p

roje

ct te

mpl

ate

prov

ides

doc

umen

tatio

n on

how

to m

odify

the

code

to b

uild

a c

usto

miz

ed st

ate

mac

hine

app

licat

ion.

Onc

e yo

u cr

eate

a

proj

ect u

sing

the t

empl

ate,

you

cust

omiz

e the

code

for d

iffer

ent e

vent

s so

that

they

gen

erat

e, ac

quire

, and

save

wav

efor

m d

ata.

You

use

the G

ener

ate D

ata V

I, av

aila

ble

in th

e Sh

ared

fold

er, t

o ge

nera

te si

ne w

aves

for t

his a

pplic

atio

n. F

inal

ly, y

ou u

pdat

e th

e cu

stom

con

trols

pro

vide

d by

the

defa

ult t

empl

ate

so th

at th

e co

ntro

ls h

andl

e th

e da

ta y

ou g

ener

ate.

Page 32: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

4

Impl

emen

tatio

n1.

Clic

k th

e C

reat

e Pr

ojec

t but

ton

on th

e G

ettin

g St

arte

d w

indo

w.

2.Se

lect

the

Sim

ple

Stat

e M

achi

ne T

empl

ate

as sh

own

in F

igur

e2-

1.

Fig

ure

2-1

. C

reat

e P

roje

ct U

sing

Sim

ple

Sta

te M

achi

ne T

empl

ate

Page 33: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

5

3.C

ompl

ete

the

conf

igur

atio

n of

the

proj

ect a

s sho

wn

in F

igur

e2-

2.

Fig

ure

2-2

. P

roje

ct C

onfig

urat

ion

in th

e C

reat

e P

roje

ct D

ialo

g B

ox

1P

roje

ct N

ame—

Ent

er Acquire and Save

as

the

nam

e of

you

r ne

w p

roje

ct.

2P

roje

ct R

oot—

You

can

use

the

defa

ult l

ocat

ion

on d

isk.

3F

ile N

ame

Pre

fix—

Thi

s pr

efix

bec

omes

par

t of t

he n

ame

of p

roje

ct li

brar

y fil

es a

nd V

Is th

is te

mpl

ate

crea

tes.

Lab

VIE

W a

lso

upda

tes

icon

ban

ners

with

this

pre

fix.

4E

dit O

verla

y—C

lick

this

but

ton

to c

usto

miz

e th

e ic

on fu

rthe

r.

4321

Page 34: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

6

4.C

lick

the

Fini

sh b

utto

n to

cre

ate

and

open

the

Acq

uire

and

Sav

e pr

ojec

t.

5.In

the

Proj

ect E

xplo

rer

win

dow

, not

ice

that

the

proj

ect c

onta

ins d

ocum

enta

tion,

type

def

initi

ons,

and

a m

ain

VI c

alle

d W

MFM

ain.

vi.

6.A

dd th

e Sh

ared

fold

er to

the

Acq

uire

and

Sav

e pr

ojec

t as s

how

n in

Fig

ure

2-3.

Fig

ure

2-3

. A

ddin

g th

e S

hare

d F

olde

r to

the

Pro

ject

7.D

oubl

e-cl

ick

WFM

Mai

n.vi

in th

e Pr

ojec

t Exp

lore

r w

indo

w a

nd re

view

the

tem

plat

e co

mm

ents

on

the

fron

t pan

el.

1R

ight

-clic

k M

y C

om

pu

ter

and

sele

ct A

dd

»Fo

lder

(S

nap

sho

t) fr

om th

e sh

ortc

ut m

enu.

2N

avig

ate

to <Exercises>\LabVIEW Core 2\Shared

and

clic

k th

e C

urr

ent F

old

er b

utto

n to

add

it to

the

proj

ect.

Be

sure

the

Sha

red

fold

er is

ope

n w

hen

you

clic

k th

e C

urre

nt F

olde

r bu

tton.

1

2

Page 35: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

7

8.O

pen

the

bloc

k di

agra

m a

nd n

otic

e th

e W

hile

Loo

p an

d C

ase

stru

ctur

e ty

pica

l of a

stat

e m

achi

ne d

esig

n pa

ttern

as s

how

n Fi

gure

2-4.

Fig

ure

2-4

. W

hile

Loo

p an

d C

ase

Str

uctu

re T

ypic

al o

f Sta

te M

achi

ne D

esig

n

1C

ase

stru

ctur

e—C

onta

ins

a ca

se fo

r ea

ch s

tate

def

ined

in th

e In

itia

l Sta

te ty

pe d

efin

ition

.

2S

hift

regi

ster

s—M

aint

ain

stat

e in

form

atio

n, e

rror

info

rmat

ion,

and

dat

a fr

om o

ne it

erat

ion

of th

e W

hile

Loo

p to

the

next

. The

se r

egis

ters

ens

ure

that

info

rmat

ion

is a

cces

sibl

e in

eac

h ev

ent a

nd c

ase.

3B

lock

dia

gram

com

men

t—H

elps

gui

de y

ou in

upd

atin

g th

e te

mpl

ate.

2

31

Page 36: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

8

9.U

pdat

e th

e fr

ont p

anel

as s

how

n in

Fig

ure

2-5.

Fig

ure

2-5

. U

pdat

ing

the

Fron

t Pan

el

10.O

pen

the

bloc

k di

agra

m a

nd m

ove

the

Wav

efor

m G

raph

term

inal

out

side

the

Whi

le L

oop.

You

will

mov

e it

agai

n la

ter.

Tip

Dou

ble-

clic

k th

e W

avef

orm

Gra

ph o

n th

e fr

ont p

anel

to fi

nd th

e W

avef

orm

Gra

ph te

rmin

al o

n th

e bl

ock

diag

ram

.

1La

bels

—U

pdat

e th

e bu

tton

labe

ls to

Acq

uire

Wav

efor

m a

nd L

og to

File

. The

labe

ls c

orre

spon

d to

the

term

inal

s on

the

bloc

k di

agra

m a

nd a

re d

ispl

ayed

ther

e,

as w

ell.

2B

oole

an T

ext—

Cha

nge

the

Boo

lean

text

dis

play

ed o

n th

e bu

ttons

to A

cqui

re a

nd S

ave.

The

Boo

lean

text

is th

e te

xt d

ispl

ayed

on

the

butto

n.

3W

avef

orm

gra

ph—

Del

ete

com

men

ts b

efor

e ad

ding

the

Wav

efor

m G

raph

.

3

2

1

Page 37: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

9

11.E

dit t

he In

itial

Sta

te ty

pe d

efin

ition

, sho

wn

in F

igur

e2-

6. Fig

ure

2-6

. In

itial

Sta

te T

ype

Def

initi

on

1In

itial

Sta

te ty

pe d

efin

ition

—R

ight

-clic

k th

e In

itial

Sta

te ty

pe d

efin

ition

and

sel

ect O

pen

Typ

e D

ef.

2S

tate

s en

um—

Rig

ht-c

lick

the

Sta

tes

enum

and

sel

ect E

dit

Item

s.

12

Page 38: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

10

12.E

dit t

he e

num

stat

es a

s sho

wn

in F

igur

e2-

7.

Fig

ure

2-7

. S

tate

s E

num

Pro

pert

ies

Dia

log

Box

C

lick

OK

to c

lose

the

dial

og b

ox.

Se

lect

File

»App

ly C

hang

es.

Sa

ve th

e WfmState.ctl

file

and

clo

se th

e co

ntro

l edi

tor w

indo

w.

Page 39: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

11

13.E

dit t

he D

ata

type

def

initi

on so

that

you

can

use

it w

ith th

e w

avef

orm

dat

a in

the

appl

icat

ion.

a.O

pen

and

edit

the

Dat

a ty

pe d

efin

ition

, as s

how

n in

Fig

ure

2-8.

Fig

ure

2-8

. E

ditin

g th

e D

ata

Type

Def

initi

on

Se

lect

File

»App

ly c

hang

es to

app

ly th

e up

date

d ty

pe d

efin

ition

to th

e op

en V

I.

Sa

ve a

nd c

lose

the

cont

rol e

dito

r win

dow

.

C

lose

the

Gen

erat

e D

ata

VI.

1D

ata

type

def

initi

on—

Rig

ht-c

lick

the

Dat

a ty

pe d

efin

ition

and

sel

ect O

pen

Typ

e D

ef.

2D

efau

lt te

mpl

ate

com

pone

nts—

The

tem

plat

e in

clud

es th

ree

data

com

pone

nts

by d

efau

lt: a

Boo

lean

, a s

trin

g, a

nd a

num

eric

. Del

ete

the

defa

ult d

ata

com

pone

nts

from

the

clus

ter

in th

e ty

pe d

efin

ition

.

3O

pen

the

Gen

erat

e D

ata

VI,

loca

ted

in th

e S

har

ed fo

lder

in th

e P

roje

ct E

xplo

rer

win

dow

, and

cop

y th

e Y

con

trol

.

4P

aste

the

Y c

ontr

ol in

side

the

Dat

a ty

pe d

efin

ition

and

ren

ame

the

Y c

ontr

ol to

Arr

ay.

12

34

Page 40: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

12

14.C

ompl

ete

the

Acq

uire

Wav

efor

m c

ase

as sh

own

in F

igur

e2-

9.

D

elet

e th

e B

undl

e by

Nam

e fu

nctio

n an

d th

e O

ne B

utto

n D

ialo

g fu

nctio

n in

this

cas

e be

fore

com

plet

ing

the

bloc

k di

agra

m sh

own

in F

igur

e2-

9.

Fig

ure

2-9

. U

pdat

ing

the

Acq

uire

Wav

efor

m C

ase

1B

undl

e B

y N

ame—

Wire

the

Dat

a ty

pede

f to

the

inpu

t clu

ster

of a

Bun

dle

By

Nam

e fu

nctio

n.

2W

avef

orm

gra

ph te

rmin

al—

Dra

g th

e te

rmin

al fr

om o

utsi

de th

e W

hile

Loo

p in

to th

e A

cqui

re W

avef

orm

cas

e.

3G

ener

ate

Dat

a V

I—O

pen

the

Sha

red

fold

er in

the

Pro

ject

Exp

lore

r w

indo

w a

nd d

rag

the

Gen

erat

e D

ata

VI t

o th

e bl

ock

diag

ram

. Wire

the

Y o

utpu

t to

the

Wav

efor

m G

raph

term

inal

.

4C

reat

e co

nsta

nts

for

the

sig

nal

and

no

ise

inpu

t ter

min

als

of th

e G

ener

ate

Dat

a V

I.

5W

ire th

e Y

out

put o

f the

Gen

erat

e D

ata

VI t

o th

e A

rray

inpu

t of t

he B

undl

e B

y N

ame

func

tion.

21

5 4 3

Page 41: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

13

15.C

ompl

ete

the

Log

to F

ile c

ase

as sh

own

in F

igur

e2-

10. Fig

ure

2-1

0. U

pdat

ing

the

Log

to F

ile C

ase

1C

onve

rt to

Dyn

amic

Dat

a—C

onfig

ure

with

the

follo

win

g op

tions

:

In

pu

t D

ata

Typ

e—1D

arr

ay o

f sca

lars

—si

ngle

cha

nnel

S

cala

r D

ata

Typ

e—F

loat

ing

poin

t num

bers

(do

uble

)

Sta

rt T

ime—

Zer

o

2W

rite

to M

easu

rem

ent F

ile E

xpre

ss V

I—C

onfig

ure

with

the

follo

win

g op

tions

:

A

ctio

n—

Ask

use

r to

cho

ose

file

A

ctio

n—

Ask

eac

h ite

ratio

n

If a

file

alr

ead

y ex

ists

—O

verw

rite

file

Afte

r yo

u co

nfig

ure

the

Writ

e T

o M

easu

rem

ent F

ile E

xpre

ss V

I, rig

ht-c

lick

the

Exp

ress

VI a

nd s

elec

t Vie

w A

s Ic

on

.

3W

ire th

e C

onve

rt to

Dyn

amic

Dat

a fu

nctio

n to

the

Sig

nals

inpu

t of t

he W

rite

To

Mea

sure

men

t File

Exp

ress

VI.

3

21

Page 42: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

14

16.O

pen

the

Stop

cas

e as

show

n in

Fig

ure

2-11

.

Fig

ure

2-1

1. U

pdat

ing

the

Sto

p C

ase

17.C

lick

the

brok

en R

un b

utto

n to

find

err

ors a

nd c

lean

up

the c

ode.

Bec

ause

you

repl

aced

the

data

ele

men

ts in

the

Dat

a ty

pe d

efin

ition

, the

Boo

lean

that

the

Bun

dle

By

Nam

e fu

nctio

n us

es in

som

e ca

ses i

s no

long

er v

alid

. Del

ete

thes

e B

undl

e B

y N

ame

func

tions

and

rew

ire th

e da

ta to

the

shift

regi

ster

.

18.S

ave

the

VI.

1(V

alue

Not

Use

d) e

num

—Y

ou m

ay w

ant t

o up

date

the

labe

l for

read

abili

ty. H

owev

er, t

he a

pplic

atio

n do

es n

ot u

se th

e en

um v

alue

bec

ause

the

Sto

p b

utto

n st

ops

the

loop

bef

ore

the

next

sta

te e

xecu

tes.

1

Page 43: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

15

Test

1.R

un th

e V

I.

2.C

lick

the

Acq

uire

but

ton

mul

tiple

tim

es. T

he W

avef

orm

Gra

ph u

pdat

es w

ith n

ew d

ata

from

eac

h tim

e.

3.C

lick

the

Save

but

ton.

4.W

hen

you

finis

h ac

quiri

ng a

nd sa

ving

dat

a, c

lick

the

Stop

but

ton.

5.Sa

ve a

nd c

lose

the

VI.

End

of E

xerc

ise

2-1

Page 44: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 45: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

17

Exe

rcis

e 2-

2C

once

pt: P

rodu

cer/

Con

sum

er—

Eve

nts

Goa

lA

s a g

roup

, exp

lore

the

Prod

ucer

Con

sum

er te

mpl

ate.

Sce

nario

You

have

a V

I tha

t use

s the

Pro

duce

r/Con

sum

er d

esig

n pa

ttern

to p

roce

ss m

essa

ges.

The c

onsu

mer

rate

is sl

ower

than

the p

rodu

cer a

nd th

eref

ore,

a ba

cklo

g is

crea

ted.

Th

e V

I cle

ars m

essa

ges f

rom

the

back

log

in th

e or

der t

he m

essa

ges a

re re

ceiv

ed, u

ntil

a hi

gh p

riorit

y m

essa

ge is

intro

duce

d. H

igh

prio

rity

mes

sage

s are

pro

cess

ed a

s so

on a

s the

y ar

e re

ceiv

ed a

nd th

en th

e V

I res

umes

pro

cess

ing

norm

al p

riorit

y m

essa

ges.

Impl

emen

tatio

n1.

Ope

n th

e Pr

oduc

er C

onsu

mer

pro

ject

loca

ted

in th

e <Exercises>\LabVIEW Core 2\Producer Consumer - Event

dire

ctor

y, a

nd th

en o

pen

the

Mai

n.vi

, sho

wn

in F

igur

e2-

12 fr

om th

e pr

ojec

t.

Fig

ure

2-1

2. P

rodu

cer

Con

sum

er -

Eve

nts

Mai

n V

I Fro

nt P

anel

2.R

un th

e V

I.

3.C

lick

the

Nor

mal

Pri

ority

but

ton.

N

otic

e th

e St

ate

to E

xecu

te in

dica

tor s

ays N

ormal Priority

.

Page 46: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

18

N

otic

e th

at P

roce

ssed

Val

ue in

crea

sed

by 1

.

N

otic

e th

e H

igh

Prio

rity

? B

oole

an in

dica

tor i

s off

.

4.C

lick

the

Nor

mal

Pri

ority

but

ton

seve

ral t

imes

.

N

otic

e th

at th

e B

ackl

og in

dica

tor i

ncre

ases

.

N

otic

e th

at th

e B

ackl

og d

ecre

ases

by

1 ev

ery

seco

nd.

5.C

lick

the

Hig

h Pr

iori

ty b

utto

n.

N

otic

e th

at S

tate

to E

xecu

te sa

ys High Priority

and

the

Proc

esse

d V

alue

indi

cato

r say

s 1000

.

N

otic

e th

e H

igh

Prio

rity

? B

oole

an in

dica

tor i

s on.

6.W

atch

the

flow

of d

ata

on th

e bl

ock

diag

ram

.

Se

lect

Win

dow

»Tile

Lef

t and

Rig

ht.

C

lick

the

Hig

hlig

ht E

xecu

tion

butto

n on

the

bloc

k di

agra

m a

nd th

en ru

n th

e V

I and

wat

ch w

hat h

appe

ns w

hen

you

clic

k th

e N

orm

al P

rior

ity b

utto

n.

C

lick

the

Hig

h Pr

iori

ty b

utto

n.

N

otic

e th

at th

e W

ait (

ms)

in th

e D

efau

lt st

ate

of th

e C

onsu

mer

loop

is se

t to

1000

. Thi

s is w

hat c

ause

s the

pro

cess

ing

of o

ne m

essa

ge p

er se

cond

.

7.D

isab

le H

ighl

ight

Exe

cutio

n.

8.C

lick

the

Nor

mal

Pri

ority

but

ton

seve

ral t

imes

to c

reat

e a

back

log.

9.W

hile

the

back

log

is p

rese

nt c

lick

the

Stop

but

ton.

N

otic

e th

at th

e V

I sto

ps e

ven

thou

gh th

e ba

cklo

g ha

s not

bee

n pr

oces

sed.

Th

e E

nque

ue E

lem

ent a

t Opp

osite

End

func

tion

caus

ed th

is to

occ

ur. I

f the

Sto

p sh

ould

occ

ur a

fter a

ll m

essa

ges i

n th

e ba

cklo

g ar

e pr

oces

sed,

then

this

fu

nctio

n w

ould

be

repl

aced

with

a re

gula

r Enq

ueue

Ele

men

t fun

ctio

n.

Page 47: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

19

10.I

njec

t an

erro

r and

see

wha

t hap

pens

:

D

elet

e th

e er

ror c

lust

er w

ire ru

nnin

g th

roug

h th

e D

efau

lt st

ate

of th

e C

onsu

mer

loop

.

R

ight

-clic

k th

e er

ror o

utpu

t tun

nel o

f the

Cas

e St

ruct

ure

and

sele

ct C

reat

e»C

onst

ant.

R

un th

e V

I aga

in a

nd c

lick

Nor

mal

Pri

ority

.

N

otic

e th

at th

e V

I doe

s not

beh

ave

prop

erly

any

mor

e. T

his i

s bec

ause

an

erro

r in

the

Con

sum

er lo

op h

as c

ause

d th

e C

onsu

mer

loop

to sh

utdo

wn.

Bec

ause

th

e C

onsu

mer

loop

was

doi

ng th

e bu

lk o

f the

wor

k, th

e V

I doe

s not

beh

ave

corr

ectly

. The

Pro

duce

r loo

p is

still

runn

ing.

11.C

lose

the

VI a

nd th

e pr

ojec

t. D

o no

t sav

e yo

ur c

hang

es.

This

VI d

oes n

ot in

clud

e an

y er

ror h

andl

ing.

You

mod

ify a

ver

sion

of t

his V

I in

Exer

cise

2-3

to e

nabl

e er

ror h

andl

ing

so th

e V

I shu

ts d

own

if an

err

or o

ccur

s.

End

of E

xerc

ise

2-2

Page 48: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 49: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

21

Exe

rcis

e 2-

3C

once

pt: P

rodu

cer/

Con

sum

er E

rror

Han

dlin

g

Goa

lU

se b

utto

ns to

inje

ct e

rror

s int

o th

e Pr

oduc

er/C

onsu

mer

tem

plat

e to

test

the

erro

r han

dlin

g co

de.

Sce

nario

You

need

to te

st th

e er

ror h

andl

ing

in th

e Pr

oduc

er/C

onsu

mer

des

ign

patte

rn V

I, so

you

will

inje

ct si

mul

ated

err

ors a

s the

VI r

uns.

Des

ign

Add

but

tons

to in

ject

sim

ulat

ed e

rror

s in

the

prod

ucer

loop

and

the

cons

umer

loop

.

Impl

emen

tatio

n1.

Ope

n th

e Pr

oduc

er C

onsu

mer

pro

ject

loca

ted

in th

e <Exercises>\LabVIEW Core 2\Producer Consumer - Error

dire

ctor

y, a

nd th

en o

pen

the

Mai

n.vi

from

the

proj

ect.

This

VI i

s sim

ilar t

o th

e on

e yo

u us

ed in

Exe

rcis

e2-

2. T

he P

rodu

cer E

rror

and

Con

sum

er E

rror

but

tons

are

pro

vide

d on

the

fron

t pan

el, a

s sho

wn

in F

igur

e2-

13.

You

mod

ify th

e bl

ock

diag

ram

to e

nabl

e th

e bu

ttons

and

test

err

or h

andl

ing

in th

is V

I.

Fig

ure

2-1

3. P

rodu

cer

Con

sum

er M

ain

VI F

ront

Pan

el w

ith E

rror

But

tons

Page 50: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

22

2.C

reat

e a

new

eve

nt to

inje

ct a

n er

ror i

nto

the

Prod

ucer

Loo

p as

show

n in

Fig

ure

2-14

.

Fig

ure

2-1

4. P

rodu

cer

Con

sum

er “

Pro

duce

r E

rror

”: V

alue

Cha

nge

Eve

nt

1“P

rodu

cer

Err

or”:

Val

ue C

hang

e E

vent

—R

ight

-clic

k th

e E

vent

Str

uctu

re a

nd s

elec

t Ad

d E

ven

t C

ase.

2P

rodu

cer

Err

or—

Dra

g th

e te

rmin

al in

to th

e ne

w E

vent

Cas

e.

3E

rror

Rin

g C

onst

ant—

Whe

n an

err

or o

ccur

s, th

e V

I sto

ps r

unni

ng a

nd th

e er

ror

mes

sage

you

sel

ect h

ere

is d

ispl

ayed

in a

dia

log

box.

R

efer

to F

igur

e2-

15 to

con

figur

e th

e E

rror

Rin

g C

onst

ant.

2 3

1

Page 51: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

23

3.C

lick

the

Erro

r Rin

g co

nsta

nt a

nd c

onfig

ure

it to

dis

play

the

mes

sage

15: LabVIEW: Resource not found

as s

how

n in

Fig

ure

2-15

.

Fig

ure

2-1

5. S

elec

t Err

or

1E

rror

Cod

e R

ange

—S

elec

t Lab

VIE

W fr

om th

e dr

op-d

own

list.

2E

rror

Cod

e—S

elec

t any

err

or in

the

list a

nd ty

pe 15

to fi

nd th

is e

rror

qui

ckly

.

1 2

Page 52: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

24

4.C

reat

e th

e co

de fo

r the

Con

sum

er E

rror

but

ton

in th

e C

onsu

mer

Loo

p as

show

n in

Fig

ure

2-16

.

Fig

ure

2-1

6. P

rodu

cer

Con

sum

er C

onsu

mer

Err

or C

ode

1C

usto

m E

rror

Cod

e—R

efer

to F

igur

e2-

17 to

cre

ate

a cu

stom

err

or m

essa

ge.

2C

onsu

mer

Err

or—

Dra

g th

e te

rmin

al in

to th

e D

efau

lt ca

se o

f the

Cas

e S

truc

ture

in th

e C

onsu

mer

Loo

p.

21

Page 53: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

25

5.C

lick

the

Erro

r Rin

g co

nsta

nt a

nd c

onfig

ure

it to

dis

play

a C

usto

m E

rror

Cod

e as

show

n in

Fig

ure

2-17

.

Fig

ure

2-1

7. C

usto

m E

rror

Cod

e

6.Sa

ve th

e V

I.

Page 54: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

26

Test

1.R

un M

ain.

vi.

2.Se

nd se

vera

l nor

mal

and

hig

h pr

iorit

y m

essa

ges t

o cr

eate

a b

ackl

og.

3.C

lick

the

Prod

ucer

Err

or b

utto

n.

4.R

un th

e V

I aga

in a

nd se

nd m

ultip

le m

essa

ges.

5.C

lick

the

Con

sum

er E

rror

but

ton.

End

of E

xerc

ise

2-3

Page 55: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

27

Exe

rcis

e 2-

4H

isto

gram

Goa

lM

odify

the

prod

ucer

/con

sum

er te

mpl

ate

to c

reat

e a

hist

ogra

m fr

om a

cqui

red

data

.

Sce

nario

You

wan

t to

crea

te a

n ap

plic

atio

n w

hich

doe

s the

follo

win

g:

•Si

mul

ates

acq

uisi

tion

of a

wav

efor

m.

•Si

mul

ates

pro

cess

ing

of th

e w

avef

orm

whi

ch in

clud

es g

ener

atin

g a

hist

ogra

m.

•Sa

ves a

snap

shot

of a

his

togr

am.

You

can

mod

ify th

e pr

oduc

er/c

onsu

mer

tem

plat

e to

han

dle

thos

e th

ree

task

s as w

ell a

s err

ors a

nd U

I eve

nts f

rom

the

prod

ucer

/con

sum

er te

mpl

ate

itsel

f.

Des

ign

Afte

r cop

ying

the

tem

plat

e, y

ou u

pdat

e th

e pr

oduc

er lo

op to

gen

erat

e w

avef

orm

dat

a an

d yo

u up

date

the

cons

umer

loop

to d

ispl

ay a

his

togr

am a

nd ta

ke a

snap

shot

of

the

hist

ogra

m w

hen

the

user

spec

ifies

.

Page 56: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

28

Impl

emen

tatio

n1.

Mov

e an

d re

nam

e th

e Pr

oduc

er C

onsu

mer

pro

ject

and

file

s.

O

pen

the Producer Consumer.lvproj

loca

ted

in th

e <Exercises>\LabVIEW Core 2\Producer Consumer - Template

dire

ctor

y.

Se

lect

File

»Sav

e A

s and

set t

he sa

ve a

s opt

ions

as s

how

n in

Fig

ure

2-18

, and

then

clic

k th

e C

ontin

ue b

utto

n.

Fig

ure

2-1

8. S

ave

As

Opt

ions

En

ter H

istogram

as t

he n

ame

of th

e pr

ojec

t, an

d sa

ve th

e pr

ojec

t to

the <Exercises>\LabVIEW Core 2\Histogram

dire

ctor

y.

2.C

lose

the

Prod

ucer

Con

sum

er -

Tem

plat

e Pr

ojec

t Exp

lore

r win

dow

.

3.O

pen

His

togr

am.lv

proj

and

rena

me

the

proj

ect V

Is in

Lab

VIE

W so

that

Lab

VIE

W c

an u

pdat

e al

l lin

ks a

nd in

stan

ces o

f the

VIs

.

R

ight

-clic

k M

ain.

vi in

the

Proj

ect E

xplo

rer

win

dow

and

sele

ct R

enam

e.

R

enam

e th

e V

I as H

istogram Main.vi

and

clic

k O

K.

Page 57: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

29

4.A

dd th

e Shared

fold

er to

the

proj

ect a

s an

auto

-pop

ulat

ing

fold

er. T

he S

hare

d fo

lder

con

tain

s the

Gen

erat

e D

ata

VI a

nd th

e R

unni

ng H

isto

gram

VI t

hat y

ou u

se

late

r.

5.O

pen

the

bloc

k di

agra

m o

f the

His

togr

am M

ain

VI.

6.U

pdat

e th

e C

onsu

mer

Mes

sage

type

def

initi

on, s

how

n in

Fig

ure

2-19

to h

andl

e w

avef

orm

dat

a.

Fig

ure

2-1

9. C

onsu

mer

Mes

sage

Typ

e D

efin

ition

1C

onsu

mer

Mes

sage

type

def

initi

on—

Rig

ht-c

lick

the

Con

sum

er M

essa

ge ty

pe d

efin

ition

loca

ted

to th

e le

ft of

the

prod

ucer

loop

on

the

His

togr

am M

ain

VI b

lock

di

agra

m a

nd s

elec

t Op

en T

ype

Def

.

1

Page 58: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

30

M

odify

the

Con

sum

er M

essa

ge ty

pe d

efin

ition

as s

how

n in

Fig

ure

2-20

.

Fig

ure

2-2

0. C

onsu

mer

Mes

sage

Typ

e D

efin

ition

1A

rray

—A

dd a

n ar

ray

to th

e ty

pe d

efin

ition

so

it ca

n ha

ndle

wav

efor

m d

ata.

Ren

ame

the

Arr

ay Signal

.

2N

umer

ic In

dica

tor—

Add

a n

umer

ic in

dica

tor

to th

e ar

ray.

3R

ight

-clic

k th

e cl

uste

r bo

rder

and

sel

ect R

eord

er C

on

tro

ls In

Clu

ster

and

arr

ange

them

so

that

the

Sig

nal c

ontr

ol is

dire

ctly

bel

ow th

e N

um

eric

Dat

a co

ntro

l.

123

Page 59: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

31

A

pply

cha

nges

, sav

e, a

nd c

lose

the

type

def

initi

on.

7.D

ispl

ay th

e ty

pe d

efin

ition

as a

n ic

on o

n th

e bl

ock

diag

ram

as s

how

n in

Fig

ure

2-21

.

Fig

ure

2-2

1. V

iew

ing

a Ty

pe D

efin

ition

as

an Ic

on

1R

ight

-clic

k th

e C

onsu

mer

Mes

sage

type

def

initi

on a

nd s

elec

t Au

toS

izin

g»A

rran

ge

Ver

tica

lly fr

om th

e sh

ortc

ut m

enu.

2R

ight

-clic

k th

e C

onsu

mer

Mes

sage

type

def

initi

on a

nd s

elec

t Vie

w C

lust

er a

s Ic

on

to s

ave

spac

e on

the

bloc

k di

agra

m.

1

2

Page 60: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

32

8.Se

nd si

gnal

dat

a th

roug

h th

e C

onsu

mer

Mes

sage

type

def

initi

on. C

ompl

ete

the

Tim

eout

eve

nt in

the

prod

ucer

loop

as s

how

n in

Fig

ure

2-22

.

Fig

ure

2-2

2. U

pdat

ing

the

Pro

duce

r Lo

op T

imeo

ut E

vent

1C

onsu

mer

Mes

sage

type

def

initi

on—

Cop

y th

e C

onsu

mer

Mes

sage

type

def

initi

on a

nd p

aste

it in

side

the

Tim

eout

eve

nt c

ase.

2B

undl

e B

y N

ame

func

tion—

Wire

the

Con

sum

er M

essa

ge ty

pede

f to

the

inp

ut

clu

ster

inpu

t.

E

xpan

d th

e no

de to

dis

play

two

elem

ents

.

S

elec

t Co

nsu

mer

Sta

te a

nd S

ign

al.

3G

ener

ate

Dat

a V

I—D

rag

the

Gen

erat

e D

ata

VI f

rom

the

Sh

ared

fold

er in

the

Pro

ject

Exp

lore

r w

indo

w in

to th

e T

imeo

ut e

vent

cas

e.

4W

ire th

e Y

out

put o

f the

Gen

erat

e D

ata

VI t

o th

e S

ign

al in

put o

f the

Bun

dle

By

Nam

e fu

nctio

n.

5C

reat

e a

cont

rol f

or th

e si

gn

al in

put o

f the

Gen

erat

e D

ata

VI.

6C

reat

e a

cons

tant

for

the

Co

nsu

mer

Sta

te in

put.

7E

nque

ue E

lem

ent—

Rig

ht-c

lick

the

queu

e w

ire a

nd s

elec

t In

sert

»Qu

eue

Op

erat

ion

s P

alet

te»E

nq

ueu

e E

lem

ent.

W

ire th

e er

ror w

ire th

roug

h th

e E

nque

ue E

lem

ent f

unct

ion

to th

e G

et Q

ueue

Sta

tus

func

tion.

It w

ill a

ppea

r wire

d, b

ut w

hen

you

inse

rt th

e no

de, t

he e

rror

wire

is

beh

ind

the

Enq

ueue

Ele

men

t fun

ctio

n.

6 53 4

1

7

2

Page 61: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

33

9.C

reat

e th

e D

ispl

ay c

ase

in th

e co

nsum

er lo

op a

s sho

wn

in F

igur

e2-

23.

Fig

ure

2-2

3. U

pdat

ing

the

Con

sum

er L

oop

Dis

play

Cas

e

1O

pen

to th

e D

efau

lt ca

se o

f the

Cas

e st

ruct

ure

and

rena

me

the

case

to “Display”, Default

.

2U

nbun

dle

By

Nam

e fu

nctio

n—C

hang

e th

e N

um

eric

Dat

a el

emen

t to

Sig

nal

and

rem

ove

the

Bo

ole

an D

ata

wire

and

ele

men

t.

3R

unni

ng H

isto

gram

VI—

Dra

g th

e R

unni

ng H

isto

gram

VI f

rom

the

Sh

ared

fold

er in

the

Pro

ject

Exp

lore

r w

indo

w.

4N

umer

ic c

ontr

ol—

Cre

ate

a co

ntro

l for

the

bin

s in

put a

nd la

bel t

he c

ontr

ol Bins

.

5X

Y G

raph

(S

ilver

)—O

n th

e fr

ont p

anel

, pla

ce a

n X

Y G

raph

(S

ilver

) an

d re

nam

e it Histogram

.

6B

undl

e fu

nctio

n—W

ire th

e h

isto

gra

m a

nd x

axi

s ou

tput

s fr

om th

e R

unni

ng H

isto

gram

VI t

o th

e B

undl

e fu

nctio

n.

7R

epla

ce th

e rig

ht H

isto

gram

tunn

el w

ith a

shi

ft re

gist

er a

nd c

ompl

ete

the

shift

reg

iste

r.

8W

ire th

e le

ft sh

ift r

egis

ter

to th

e C

ase

stru

ctur

e.

9R

ight

-clic

k th

e H

isto

gram

out

put t

unne

l and

sel

ect L

inke

d In

pu

t tu

nn

el»C

reat

e &

Wir

e U

nw

ired

Cas

es a

nd th

en c

lick

the

His

togr

am in

put t

unne

l on

the

left.

10 R

ight

-clic

k th

e le

ft sh

ift r

egis

ter

and

crea

te a

con

stan

t.

42

77

810

31

6

5

9

Page 62: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

34

10.C

reat

e a

Snap

shot

eve

nt in

the

prod

ucer

loop

by

chan

ging

the

“Hig

h Pr

iorit

y M

essa

ge”:

Val

ue C

hang

e ev

ent,

as sh

own

in F

igur

e2-

24.

Fig

ure

2-2

4. U

pdat

ing

the

Pro

duce

r Lo

op “

Sna

psho

t”: V

alue

Cha

nge

Eve

nt

1C

hang

e th

e ev

ent n

ame—

Cha

nge

the

labe

l of t

he H

igh

Pri

ori

ty b

utto

n to

Snapshot

. Cha

ngin

g th

e na

me

of th

e bu

tton

chan

ges

the

even

t nam

e.

2B

undl

e B

y N

ame

func

tion—

Del

ete

the

valu

es w

ired

to th

e B

oo

lean

Dat

a an

d N

um

eric

Dat

a in

puts

of t

he B

undl

e B

y N

ame

func

tion

and

hide

the

term

inal

s.

3C

hang

e th

e va

lue

of th

e C

on

sum

er S

tate

str

ing

cons

tant

to Snapshot

.

4D

oubl

e-cl

ick

the

Sn

apsh

ot

cont

rol t

o lo

cate

the

butto

n on

the

fron

t pan

el. C

hang

e th

e B

oole

an te

xt d

ispl

ayed

on

the

butto

n to

Snapshot

.

32

1

4

Page 63: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

35

11.A

dd th

e Sn

apsh

ot c

ase

to th

e co

nsum

er lo

op a

s sho

wn

in F

igur

e2-

25.

Fig

ure

2-2

5. U

pdat

ing

the

Con

sum

er L

oop

Sna

psho

t Eve

nt

12.D

elet

e th

e N

orm

al P

riorit

y M

essa

ge e

vent

from

the

Even

t stru

ctur

e in

the

Prod

ucer

Loo

p. L

abV

IEW

del

etes

the

corr

espo

ndin

g bu

tton

from

the

fron

t pan

el.

1D

uplic

ate

the

Initi

aliz

e ca

se—

Rig

ht-c

lick

the

case

str

uctu

re a

nd s

elec

t Du

plic

ate

Cas

e. R

enam

e th

e du

plic

ate

case

Snapshot

.

2U

nbun

dle

func

tion—

Afte

r yo

u w

ire th

e in

put,

the

Unb

undl

e fu

nctio

n co

ntai

ns tw

o 1D

arr

ays.

3B

uild

Arr

ay fu

nctio

n—W

ire b

oth

1D A

rray

out

puts

to th

e B

uild

Arr

ay fu

nctio

n.

4 W

rite

to S

prea

dshe

et F

ile V

I—W

ire th

e ap

pen

ded

arr

ay o

utpu

t of t

he B

uild

Arr

ay fu

nctio

n to

the

2D d

ata

inpu

t.

2

3

41

Page 64: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

36

13.C

lean

up th

e fr

ont p

anel

of t

he V

I as s

how

n in

Fig

ure

2-26

.

Fig

ure

2-2

6. C

lean

ing

Up

the

Fron

t Pan

el o

f the

His

togr

am M

ain

VI

Test

1.R

un th

e V

I.

2.To

cre

ate

the

look

of a

his

togr

am in

the

char

t, cl

ick

the

plot

lege

nd a

nd se

lect

a h

oriz

onta

l bar

plo

t typ

e fr

om th

e bo

ttom

row

. You

may

als

o w

ant t

o re

mov

e th

e lin

e in

terp

olat

ion

by c

licki

ng th

e pl

ot le

gend

and

sele

ctin

g In

terp

olat

ion

from

the

shor

tcut

men

u.

3.N

otic

e ho

w c

hang

ing

the

Sign

al a

nd B

ins v

alue

s cha

nges

the

look

of t

he h

isto

gram

.

4.C

lick

the

Snap

shot

but

ton.

A fi

le d

ialo

g bo

x di

spla

ys so

you

can

save

the

hist

ogra

m fi

le.

C

hoos

e a

nam

e fo

r the

new

file

, inc

ludi

ng .txt

.

W

hile

the

dial

og b

ox is

ope

n, th

e B

ackl

og in

dica

tor r

ises

.

Page 65: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

37

C

lick

the

Save

but

ton

to sa

ve th

e fil

e.

Th

e B

ackl

og in

dica

tor s

houl

d qu

ickl

y de

crea

se.

5.C

lick

the

Stop

but

ton

to st

op th

e V

I.

6.O

pen

the

save

d te

xt fi

le a

nd re

view

the

cont

ents

to se

e th

e bi

ns a

nd v

alue

s of t

he h

isto

gram

.

7.Sa

ve a

nd c

lose

the

His

togr

am p

roje

ct.

End

of E

xerc

ise

2-4

Page 66: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 67: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

39

Exe

rcis

e 2-

5U

ser

Acc

ess

Leve

l

Goa

lTo

cre

ate

a ga

ting

appl

icat

ion,

usi

ng a

func

tiona

l glo

bal v

aria

bles

des

ign

patte

rn, w

hich

rest

ricts

use

r acc

ess t

o ce

rtain

feat

ures

bas

ed o

n di

ffere

nt u

ser a

cces

s lev

els.

Sce

nario

You

need

to c

reat

e an

app

licat

ion

in w

hich

som

e fe

atur

es a

re n

ot a

vaila

ble

to a

ll us

ers.

You

crea

te a

fini

te n

umbe

r of u

ser a

cces

s lev

els a

nd a

ssig

n an

app

ropr

iate

use

r le

vel t

o va

rious

use

rs. Y

ou u

se a

func

tiona

l glo

bal v

aria

ble

desi

gn p

atte

rn to

che

ck fo

r diff

eren

t acc

ess l

evel

s.

Des

ign

The f

ollo

win

g ta

ble d

escr

ibes

the d

iffer

ent a

ctio

ns y

ou n

eed

to h

andl

e so

you

can

impl

emen

t use

r acc

ess c

ontro

l. In

this

exer

cise

, you

crea

te a

cust

om co

ntro

l to

hand

le

thes

e ite

ms.

Act

ion

D

escr

ipti

on

Rea

d U

ser A

cces

s Lev

el F

ileR

eads

info

rmat

ion

abou

t aut

horiz

ed u

sers

and

thei

r acc

ess l

evel

s fro

m a

spec

ified

file

and

stor

es th

is a

cces

s inf

orm

atio

n in

m

emor

y.

Set C

urre

nt A

cces

s Lev

elSe

ts th

e ac

cess

leve

l of t

he c

urre

nt u

ser i

n ap

plic

atio

n m

emor

y.

Get

Cur

rent

Acc

ess L

evel

Ret

rieve

s the

acc

ess l

evel

from

mem

ory

so th

at th

e ap

plic

atio

n ca

n de

term

ine

if a

user

has

acc

ess t

o a

certa

in fe

atur

e.

Page 68: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

40

Impl

emen

tatio

n1.

Ope

n th

e User Level FGV.lvproj

pro

ject

from

<Exercises>\LabVIEW Core 2\FGVs

.

2.O

pen

the

Use

r L

evel

FG

V fo

lder

in th

e Pr

ojec

t Exp

lore

r w

indo

w a

nd th

en o

pen

Use

r A

cces

s Lev

el F

GV

.vi.

The

Use

r Acc

ess L

evel

FG

V V

I alre

ady

cont

ains

se

vera

l ite

ms o

n th

e fr

ont p

anel

, an

icon

, and

con

nect

or p

ane.

3.C

reat

e a

type

-def

ined

enu

m c

ontro

l and

mod

ify th

e fr

ont p

anel

as s

how

n in

Fig

ure

2-27

.

Fig

ure

2-2

7. U

ser

Acc

ess

Leve

l FG

V F

ront

Pan

el

1E

num

(S

ilver

)—R

ight

-clic

k th

e en

um c

ontr

ol a

nd s

elec

t Mak

e T

ype

Def

, and

then

rig

ht-c

lick

and

sele

ct O

pen

Typ

e D

ef.

Page 69: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

41

4.A

dd th

e th

ree

actio

ns li

sted

in th

e D

esig

n se

ctio

n of

this

exe

rcis

e to

the

Use

r Lev

el C

md

type

def

initi

on a

s sho

wn

in F

igur

e2-

28.

Fig

ure

2-2

8. E

ditin

g th

e U

ser

Acc

ess

Leve

l Cm

d E

num

5.Sa

ve th

e en

um a

s User Level Cmd.ctl

in <Exercises>\LabVIEW Core 2\FGVs\User Level FGV

and

clo

se th

e cu

stom

con

trol e

dito

r win

dow

.

6.Fr

om th

e U

ser A

cces

s Lev

el F

GV

VI f

ront

pan

el, a

ssig

n a

term

inal

from

the

top-

leve

l of t

he U

ser A

cces

s Lev

el F

GV

VI c

onne

ctor

pan

e to

the

Use

r L

evel

Cm

d co

ntro

l as s

how

n in

Fig

ure

2-29

.

Fig

ure

2-2

9. A

ssig

n th

e U

ser

Leve

l Cm

d C

ontr

ol to

a C

onne

ctor

Pan

e Te

rmin

al

1E

num

—R

ight

-clic

k an

d se

lect

Edi

t Ite

ms.

1C

onne

ctor

pan

e te

rmin

al—

Clic

k th

is te

rmin

al, t

hen

clic

k th

e U

ser

Lev

el C

md

con

trol

to a

ssig

n th

e co

ntro

l to

the

conn

ecto

r pa

ne te

rmin

al.

R

ight

-clic

k th

e co

nnec

tor

pane

term

inal

and

sel

ect T

his

Co

nn

ecti

on

Is»R

equ

ired

. By

mak

ing

this

term

inal

req

uire

d, a

n ap

plic

atio

n m

ust p

rovi

de a

val

ue to

th

e U

ser

Leve

l Cm

d in

put w

hen

you

use

the

Use

r A

cces

s Le

vel V

I in

anot

her

VI.

1

1

Page 70: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

42

7.C

reat

e th

e fr

amew

ork

for t

he fu

nctio

nal g

loba

l var

iabl

e de

sign

by

com

plet

ing

the

bloc

k di

agra

m a

s sho

wn

in F

igur

e2-

30.

Fig

ure

2-3

0. C

reat

ing

the

Fun

ctio

nal G

loba

l Var

iabl

e D

esig

n Fr

amew

ork

Tip

Use

the

Add

Cas

e fo

r Eve

ry V

alue

opt

ion

whe

n yo

u kn

ow th

at e

ach

case

dia

gram

is si

gnifi

cant

ly d

iffer

ent.

If c

ases

con

tain

sim

ilar s

ubdi

agra

ms,

use

the

Dup

licat

e C

ase

optio

n in

stea

d. A

fter y

ou d

uplic

ate

a ca

se, y

ou c

an m

odify

and

rena

me

it.

1C

ase

sele

ctor

—W

ire th

e E

rro

r In

clu

ster

to th

e ca

se s

elec

tor

of th

e ou

ter

case

str

uctu

re to

set

the

erro

r an

d no

err

or c

ases

.

2C

ase

sele

ctor

—W

ire U

ser

Lev

el C

md

to th

e ca

se s

elec

tor.

3C

ase

stru

ctur

e—R

ight

-clic

k th

e C

ase

stru

ctur

e an

d se

lect

Ad

d C

ase

for

Eve

ry V

alu

e fr

om th

e sh

ortc

ut m

enu

and

then

sel

ect “

Rea

d U

ser

Acc

ess

Leve

l File

”,

Def

ault.

4E

rror

In/E

rror

Out

—W

ire E

rro

r In

to E

rro

r O

ut

thro

ugh

the

defa

ult c

ase.

5W

ire E

rror

In/E

rror

Out

thro

ugh

all c

ases

—R

ight

-clic

k th

e ou

tput

tunn

el a

nd s

elec

t Lin

ked

Inp

ut

Tu

nn

el»C

reat

e &

Wir

e U

nw

ired

Cas

es. W

hen

the

curs

or

chan

ges

to a

wiri

ng to

ol, c

lick

on th

e le

ft-si

de in

put t

unne

l. S

mal

l whi

te tr

iang

les

insi

de th

e in

put a

nd o

utpu

t tun

nels

indi

cate

the

link.

1

55

423

Page 71: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

43

8.C

ompl

ete

the

Rea

d U

ser A

cces

s Lev

el F

ile c

ase

as sh

own

in F

igur

e2-

31.

Fig

ure

2-3

1. C

onfig

urin

g th

e R

ead

Use

r A

cces

s Le

vel F

ile C

ase

1T

he p

ath

to User Access Levels.txt

is r

elat

ive

to w

here

you

sav

e th

e U

ser

Acc

ess

Leve

l FG

V V

I. In

this

cas

e, th

e te

xt fi

le is

in a

par

alle

l dire

ctor

y.

2R

ead

Fro

m S

prea

dshe

et F

ile V

I—C

lick

the

poly

mor

phic

sel

ecto

r an

d se

lect

Str

ing

.

W

ire th

e al

l ro

ws

outp

ut th

roug

h a

tunn

el o

n th

e C

ase

Str

uctu

re to

the

Whi

le L

oop.

3S

hift

regi

ster

—R

ight

-clic

k th

e tu

nnel

and

sel

ect R

epla

ce w

ith

Sh

ift

Reg

iste

r. C

lick

the

left

side

of t

he W

hile

Loo

p to

com

plet

e th

e sh

ift r

egis

ter.

4La

bel—

Rig

ht-c

lick

the

wire

and

sel

ect V

isib

le It

ems»

Lab

el to

sho

w th

e la

bel,

then

type

the

nam

e User Names & Levels

.

5Li

nk th

e ou

tput

tunn

el to

the

corr

espo

ndin

g in

put t

unne

l and

cre

ate

and

wire

unw

ired

case

s of

the

tunn

el.

1

55

2

33

4

Page 72: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

44

9.C

ompl

ete

the

Set C

urre

nt A

cces

s Lev

el c

ase

as sh

own

in F

igur

e2-

32.

Fig

ure

2-3

2.

Con

figur

ing

the

Set

Cur

rent

Acc

ess

Leve

l Cas

e

1In

dex

Arr

ay fu

nctio

n—W

ire th

e U

ser

Nam

es &

Lev

els

wire

to a

n In

dex

Arr

ay fu

nctio

n.

2U

ser

Leve

ls C

olum

n an

d N

ames

Col

umn

cons

tant

s—C

reat

e co

nsta

nts

for

the

ind

ex (

col)

inpu

t of t

he In

dex

Arr

ay fu

nctio

n.

3S

hift

regi

ster

—C

hang

e th

e tu

nnel

to s

hift

regi

ster

.

4R

ight

-clic

k th

e ou

tput

tunn

el a

nd s

elec

t Lin

k In

pu

t T

un

nel

»Cre

ate

& W

ire

All

Un

wir

ed C

ases

.

12

44

3

Page 73: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

45

10.L

eave

the

Get

Cur

rent

Acc

ess L

evel

cas

e as

show

n in

Fig

ure

2-33

.

Fig

ure

2-3

3.

Get

Cur

rent

Acc

ess

Leve

l Cas

e

11.W

ire th

e Er

ror C

ase

as sh

own

in F

igur

e2-

34.

Fig

ure

2-3

4. N

o E

rror

Cas

e

Page 74: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 2

Impl

emen

ting

Des

ign

Pat

tern

sni

.com

|2-

46

12.S

ave

and

clos

e th

e V

I.

Test

1.Fr

om th

e pro

ject

, ope

n User Access Levels.txt

and

revi

ew th

e con

tent

s of t

he fi

le. T

his f

ile c

onta

ins t

he n

ames

of a

utho

rized

use

rs a

nd th

eir a

cces

s lev

els.

You

can

add

addi

tiona

l use

r nam

es a

nd le

vels

if y

ou w

ant.

2.D

oubl

e-cl

ick

Use

r A

cces

s Lev

el F

GV

Uni

t Tes

t.vi i

n th

e Pr

ojec

t Exp

lore

r w

indo

w to

ope

n th

e V

I. Th

is V

I tak

es a

use

r nam

e yo

u in

put,

sets

the

perm

issi

ons

of th

e V

I to

the

user

's ac

cess

leve

l, an

d te

sts w

heth

er th

e pr

oper

acc

ess l

evel

is se

t.

3.C

ompl

ete

the

“Set

Use

r Acc

ess L

evel

”: V

alue

Cha

nge

even

t as s

how

n in

Fig

ure

2-35

.

Fig

ure

2-3

5. C

ompl

etin

g th

e “S

et U

ser

Acc

ess

Leve

l”: V

alue

Cha

nge

Eve

nt

1U

ser

Acc

ess

Leve

l FG

V V

I—T

his

is th

e V

I you

mod

ified

in th

is e

xerc

ise.

It h

as a

lread

y be

en p

lace

d on

the

bloc

k di

agra

m.

2U

ser

Leve

l Cm

d C

onst

ants

—R

ight

-clic

k th

e U

ser

Leve

l Cm

d in

put a

nd s

elec

t Cre

ate»

Co

nst

ant.

2

2

11

Page 75: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|2-

47

4.C

ompl

ete

the

“Acc

ess S

ecur

e A

rea”

: Val

ue C

hang

e ev

ent c

ase

as sh

own

in F

igur

e2-

36.

Fig

ure

2-3

6. C

ompl

etin

g th

e “A

cces

s S

ecur

e A

rea”

: Val

ue C

hang

e E

vent

5.R

un th

e V

I with

the

follo

win

g us

er n

ames

and

ver

ify th

e us

er le

vel i

s cor

rect

by

clic

king

the

Tes

t Acc

ess L

evel

but

ton.

6.Sa

ve a

nd c

lose

the

proj

ect.

End

of E

xerc

ise

2-5

Use

r N

ame

Use

r L

evel

John

Ope

rato

r

Paul

Adm

in

Geo

rge

Adm

in

Rin

goO

pera

tor

Page 76: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 77: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|

3-13

Con

trol

ling

the

Use

r In

terf

ace

Exe

rcis

esEx

erci

se 3

-1D

ispl

ay T

empe

ratu

re a

nd L

imits

Exer

cise

3-2

Cus

tom

izin

g th

e V

I Win

dow

Exer

cise

3-3

Usi

ng S

ubV

Is

Page 78: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 79: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

3

Exe

rcis

e 3-

1D

ispl

ay T

empe

ratu

re a

nd L

imits

Goa

lU

se P

rope

rty N

odes

to c

hang

e th

e pr

oper

ties o

f fro

nt p

anel

obj

ects

pro

gram

mat

ical

ly.

Sce

nario

Com

plet

e a

VI t

hat r

ecor

ds te

mpe

ratu

re to

a w

avef

orm

cha

rt. D

urin

g ex

ecut

ion,

the

VI p

erfo

rms t

he fo

llow

ing

task

s:

•D

isab

le a

nd e

nabl

e th

e co

ntro

ls a

t the

star

t and

com

plet

ion

of e

xecu

tion.

•Se

t the

Δx

valu

e of

the

char

t to

the

user

-def

ined

val

ue.

•C

lear

the

wav

efor

m c

hart

so it

initi

ally

con

tain

s no

data

.

•C

halle

nge:

Cha

nge

the

colo

r of a

plo

t if t

he d

ata

exce

eds a

cer

tain

val

ue.

Des

ign

You

build

this

VI i

n fo

ur st

ages

, inc

ludi

ng a

cha

lleng

e.

Part

1—D

isab

le C

ontro

ls

Part

2—En

able

Con

trols

Part

3—C

lear

Cha

rt

Part

4—C

halle

nge:

Cha

nge

the

Plot

Col

or

Page 80: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-4

Impl

emen

tatio

n

Par

t 1—

Dis

able

Con

trol

s1.

Ope

n Temperature Limit.vi

from

the

Tem

pera

ture

Lim

it pr

ojec

t loc

ated

in th

e <Exercises>\LabVIEWCore 2\Temp Limit - Ctl Props

di

rect

ory.

Fig

ure

3-1

. Te

mpe

ratu

re L

imit

Fron

t Pan

el

2.R

un th

e V

I and

then

clic

k th

e St

art A

cqui

sitio

n bu

tton.

N

otic

e th

at w

hile

the

VI r

uns,

the

cont

rols

are

still

ena

bled

.You

can

cha

nge

the

valu

es o

n th

e co

ntro

ls w

hile

the

VI r

uns.

C

lick

the

Stop

but

ton.

Page 81: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

5

3.M

odify

the

bloc

k di

agra

m a

s sho

wn

in F

igur

e3-

2 to

dis

able

the

cont

rols

whe

n th

e V

I is r

unni

ng.

Fig

ure

3-2

. Te

mpe

ratu

re L

imit—

Dis

able

Con

trol

s B

lock

Dia

gram

1D

elta

t (m

s) P

rope

rty

Nod

e—R

ight

-clic

k th

e D

elta

t (m

s) c

ontr

ol a

nd s

elec

t Cre

ate»

Pro

per

ty N

od

e»D

isab

led

. Rig

ht c

lick

the

prop

erty

nod

e an

d se

lect

C

han

ge

All

toW

rite

.

2H

igh

Lim

it P

rope

rty

Nod

e—In

the

Tim

eout

Eve

nt C

ase,

rig

ht-c

lick

the

Hig

h Li

mit

cont

rol a

nd s

elec

t Cre

ate»

Pro

per

ty N

od

e»D

isab

led

.

P

lace

the

Pro

pert

y N

ode

outs

ide

the

Whi

le L

oop,

so

you

can

mov

e it

into

the

“Sta

rt”:

Val

ue C

hang

e ev

ent c

ase.

R

ight

-clic

k th

e pr

oper

ty n

ode

and

sele

ct C

han

ge

All

toW

rite

.

3T

empe

ratu

re P

rope

rty

Nod

e—In

the

Tim

eout

Eve

nt C

ase,

rig

ht-c

lick

the

Tem

pera

ture

indi

cato

r an

d se

lect

Cre

ate»

Pro

per

ty N

od

e»X

Sca

le»

Off

set

and

Mu

ltip

lier»

Mu

ltip

lier.

P

lace

the

Pro

pert

y N

ode

outs

ide

the

Whi

le L

oop,

so

you

can

mov

e it

into

the

“Sta

rt”:

Val

ue C

hang

e ev

ent c

ase.

R

ight

-clic

k th

e pr

oper

ty n

ode

and

sele

ct C

han

ge

All

toW

rite

.

M

ove

the

Hig

h Li

mit

prop

erty

nod

e in

to th

e “S

tart

”: V

alue

Cha

nge

even

t cas

e.

4T

o D

oubl

e P

reci

sion

Flo

at—

Con

vert

s th

e I3

2 in

put f

rom

the

Del

ta t

(ms)

con

trol

to a

dou

ble

prec

isio

n nu

mbe

r.

5R

ight

-clic

k th

e D

elta

t (m

s) p

rope

rty

node

and

sel

ect C

reat

e»C

on

stan

t an

d se

t it t

o D

isab

led

an

d G

raye

d O

ut.

1

4

32

5

Page 82: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-6

Test

1.R

un th

e V

I and

clic

k th

e St

art A

cqui

sitio

n bu

tton.

The

Del

ta t

(ms)

and

Hig

h Li

mit

cont

rols

are

dis

able

d an

d gr

ayed

out

.

2.St

op th

e V

I.

3.R

un th

e V

I a se

cond

tim

e, c

lick

the

Star

t Acq

uisi

tion

butto

n an

d no

tice

that

the

cont

rols

are

still

dis

able

d.

Page 83: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

7

Par

t 2—

Ena

ble

Con

trol

sYo

u w

ant t

o di

sabl

e th

e co

ntro

ls w

hile

the

VI i

s run

ning

, how

ever

, you

wan

t to

enab

le th

em a

gain

the

next

tim

e yo

u ru

n th

e V

I. 1.

Mod

ify th

e bl

ock

diag

ram

as s

how

n in

Fig

ure

3-3

to e

nabl

e th

e co

ntro

ls e

ach

time

you

run

the

VI.

Fig

ure

3-3

. Te

mpe

ratu

re L

imit—

Ena

ble

Con

trol

s B

lock

Dia

gram

Test

1.R

un th

e V

I and

not

ice

that

the

cont

rols

are

ena

bled

aga

in b

efor

e yo

u cl

ick

the

Star

t Acq

uisi

tion

butto

n.

2.Se

t diff

eren

t val

ues f

or th

e co

ntro

ls a

nd c

lick

the

Star

t Acq

uisi

tion

butto

n. N

otic

e th

at th

e da

ta d

ispl

ayed

on

the

char

t sta

rts fr

om w

here

it st

oppe

d th

e la

st ti

me

you

ran

the

VI.

1C

reat

e co

pies

of t

he D

elta

t (m

s) a

nd H

igh

Lim

it pr

oper

ty n

odes

and

dra

g th

em to

the

left

of th

e W

hile

Loo

p.

2C

reat

e a

cons

tant

to e

nabl

e th

e co

ntro

ls.

21

Page 84: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-8

Par

t 3—

Cle

ar C

hart

You

wan

t to

clea

r the

cha

rt ea

ch ti

me

you

run

the

VI.

1.M

odify

the

bloc

k di

agra

m a

s sho

wn

in F

igur

e3-

4 to

cle

ar o

ld d

ata

from

the

char

t eac

h tim

e yo

u ru

n th

e V

I.

Fig

ure

3-4

. Te

mpe

ratu

re L

imit—

Cle

ar C

hart

Blo

ck D

iagr

am

Test

1.R

un th

e V

I, cl

ick

the

Star

t Acq

uisi

tion

butto

n an

d le

t the

VI r

un fo

r a fe

w se

cond

s, th

en c

lick

the

Stop

but

ton.

2.R

un th

e V

I a se

cond

tim

e. N

otic

e th

at th

e ch

art c

lear

s bef

ore

you

clic

k th

e St

art A

cqui

sitio

n bu

tton

and

new

dat

a is

writ

ten

to it

.

Par

t 4—

Cha

lleng

e: C

hang

e th

e P

lot C

olor

Mod

ify th

e V

I so

that

the

Dat

a pl

ot c

hang

es c

olor

whe

n it

exce

eds t

he h

igh

limit.

End

of E

xerc

ise

3-1

1T

empe

ratu

re P

rope

rty

Nod

e—C

reat

e a

copy

of t

he T

empe

ratu

re P

rope

rty

node

and

dra

g it

to th

e le

ft of

the

Whi

le L

oop.

C

lick

the

new

pro

pert

y no

de a

nd s

elec

t His

tory

Dat

a.

2R

ight

-clic

k th

e H

isto

ry in

put a

nd s

elec

t Cre

ate»

Co

nst

ant.

Thi

s cr

eate

s a

clus

ter w

ith v

alue

s of

0 to

initi

aliz

e th

e te

mpe

ratu

re c

hart

to 0

whe

n th

e V

I sta

rts

runn

ing.

1

2

Page 85: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

9

Exe

rcis

e 3-

2C

usto

miz

ing

the

VI W

indo

w

Goa

lA

ffect

the

attri

bute

s of a

VI b

y us

ing

Prop

erty

Nod

es a

nd In

voke

Nod

es.

Sce

nario

You

can

set t

he a

ppea

ranc

e pr

oper

ties o

f a V

I sta

tical

ly b

y us

ing

the

VI p

rope

rties

pag

e. H

owev

er, r

obus

t use

r int

erfa

ces o

ften

mus

t mod

ify th

e ap

pear

ance

of a

fron

t pa

nel w

hile

the

prog

ram

runs

.

Mod

ify th

e Te

mpe

ratu

re L

imit

VI t

o ha

ve th

e fo

llow

ing

appe

aran

ce a

nd b

ehav

iors

whe

n th

e V

I is r

unni

ng:

•H

ide

the

tool

bar

•H

ide

the

men

u ba

r

•H

ide

the

scro

ll ba

rs

•M

ove

to th

e ce

nter

of t

he sc

reen

•W

rite

data

to a

n Ex

cel f

ile

Des

ign

Pro

pert

ies

Use

the

follo

win

g pr

oper

ties a

nd m

etho

ds o

n th

e V

I cla

ss:

•Sh

owM

enuB

ar—

Whe

n th

is p

rope

rty is

fals

e, th

e m

enu

bar o

f the

VI i

s not

dis

play

ed.

Fig

ure

3-5

. V

I Men

u B

ar

•T

ool B

ar V

isib

le—

Whe

n th

is p

rope

rty is

fals

e, th

e to

ol b

ar o

f the

VI i

s not

dis

play

ed.

Fig

ure

3-6

. V

I Too

l Bar

Page 86: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-10

Met

hods

Unl

ike

prop

ertie

s, a

met

hod

has a

n ef

fect

eve

ry ti

me

you

call

it. T

here

fore

, you

shou

ld c

all m

etho

ds o

nly

whe

n yo

u w

ant t

o pe

rfor

m a

n ac

tion.

For

exa

mpl

e, if

you

ca

ll th

e Fp

.Cen

ter m

etho

d du

ring

each

iter

atio

n of

a lo

op, t

he V

I is c

ontin

ually

cen

tere

d, th

ereb

y pr

even

ting

the

user

from

mov

ing

it. Y

ou c

an u

se a

Cas

e st

ruct

ure

to

cont

rol c

allin

g th

e m

etho

d in

a g

iven

iter

atio

n of

a lo

op. U

se th

e fo

llow

ing

met

hod

on th

e V

I cla

ss:

•C

ente

r—Ea

ch ti

me

this

met

hod

is c

alle

d, th

e V

I mov

es to

the

cent

er o

f the

scre

en.

Tip

Use

the

Con

text

Hel

p w

indo

w to

vie

w d

escr

iptio

ns o

f eac

h pr

oper

ty a

nd m

etho

d.

Afte

r you

impl

emen

t the

cha

nges

to th

e V

I, w

hen

you

run

the

Tem

pera

ture

Lim

it V

I it s

houl

d m

ove

to th

e ce

nter

of t

he sc

reen

and

look

sim

ilar t

o Fi

gure

3-7.

Fig

ure

3-7

. Te

mpe

ratu

re L

imit

VI F

ront

Pan

el w

ith C

usto

miz

ed A

ppea

ranc

e

Page 87: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

11

Impl

emen

tatio

n

Par

t 1—

Set

App

eara

nce

Pro

pert

ies

1.O

pen

the

Tem

pera

ture

Lim

it V

I fro

m th

e Te

mpe

ratu

re L

imit

proj

ect l

ocat

ed in

the <Exercises>\LabVIEW Core 2\Temp Limit - Methods

dire

ctor

y.

2.M

odify

the

bloc

k di

agra

m a

s sho

wn

in F

igur

e3-

8 to

hid

e th

e sc

rollb

ars,

men

u ba

r, an

d to

ol b

ar, a

nd c

ente

r the

fron

t pan

el o

n th

e sc

reen

whi

le th

e V

I is r

unni

ng.

Page 88: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-12

Fig

ure

3-8

. Te

mpe

ratu

re L

imit

VI—

Met

hods

Blo

ck D

iagr

am

No

teN

otic

e th

at th

e sc

rollb

ar v

isib

ility

pro

perti

es a

pply

to th

e Pa

ne c

lass

, not

the

VI c

lass

. The

fron

t pan

el c

an b

e sp

lit in

to m

ultip

le p

anes

usi

ng th

e ho

rizon

tal s

plitt

er b

ar o

r ver

tical

split

ter b

ar. E

ach

pane

can

hav

e its

ow

n sc

rollb

ars.

3.Sa

ve th

e V

I.

1P

rope

rty

Nod

e—R

ight

-clic

k th

e pr

oper

ty n

ode

and

sele

ct L

ink

to»P

ane»

Pan

e.

R

ight

-clic

k an

d se

lect

Ch

ang

e A

ll to

Wri

te.

E

xpan

d th

e no

de to

dis

play

two

prop

ertie

s an

d se

t the

m to

Ho

rizo

nta

l Scr

oll

Bar

Vis

ibili

ty a

nd V

erti

cal S

cro

llbar

Vis

ibili

ty.

2O

ff W

hile

Run

ning

con

stan

t—R

ight

-clic

k on

e of

the

inpu

ts to

the

Pan

e pr

oper

ty n

ode

and

sele

ct C

reat

e»C

on

stan

t.

3P

rope

rty

Nod

e—R

ight

-clic

k th

e pr

oper

ty n

ode

and

choo

se S

elec

t C

lass

»VI S

erve

r»V

I»V

I.

R

ight

-clic

k an

d se

lect

Ch

ang

e A

ll to

Wri

te.

E

xpan

d th

e no

de to

dis

play

two

prop

ertie

s.

C

lick

the

top

prop

erty

and

sel

ect F

ron

t P

anel

Win

do

w»S

ho

w M

enu

Bar

.

C

lick

the

low

er p

rope

rty

and

sele

ct T

oo

l Bar

»Vis

ible

.

W

hen

you

wire

a F

alse

con

stan

t to

each

of t

he p

rope

rtie

s, th

e m

enu

bar

and

tool

bar

will

be

hidd

en w

hen

the

VI r

uns.

4In

voke

Nod

e—C

lick

Met

hod

and

sele

ct F

ron

t P

anel

»Cen

ter.

You

mus

t wire

the

refe

renc

e fr

om th

e V

I pro

pert

y no

de b

efor

e se

tting

this

met

hod.

12

34

Page 89: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

13

Test

1.R

un th

e V

I.

2.V

erify

that

the

scro

ll ba

rs, t

ool b

ar, a

nd m

enu

bar a

re n

ot d

ispl

ayed

, and

that

the

fron

t pan

el w

indo

w is

cen

tere

d on

the

scre

en w

hile

the

VI r

uns.

3.St

op th

e V

I.

Page 90: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-14

Par

t 2—

Exp

ort D

ata

Add

a m

etho

d to

exp

ort T

empe

ratu

re c

hart

data

to E

xcel

.

1.M

odify

the

bloc

k di

agra

m a

s sho

wn

in F

igur

e3-

9 to

exp

ort t

he d

ata

disp

laye

d on

the

Tem

pera

ture

cha

rt to

Exc

el.

Fig

ure

3-9

. Te

mpe

ratu

re L

imit

VI—

Exp

ort t

o E

xcel

Blo

ck D

iagr

am

2.Sa

ve th

e V

I.

Test

1.R

un th

e V

I.

2.C

lick

Stop

. The

Exp

ort D

ata

to E

xcel

met

hod

crea

tes a

tem

pora

ry E

xcel

file

with

the

data

from

the

Wav

efor

m c

hart.

Vie

w th

e da

ta in

the

Exce

l file

.

3.Sa

ve a

nd c

lose

the

VI.

End

of E

xerc

ise

3-2

1T

empe

ratu

re In

voke

Nod

e—R

ight

-clic

k th

e T

empe

ratu

re in

dica

tor

and

sele

ct C

reat

e»In

voke

No

de»

Exp

ort

Dat

a to

Exc

el.

1

Page 91: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

15

Exe

rcis

e 3-

3U

sing

Sub

VIs

Goa

lU

se c

ontro

l ref

eren

ces t

o cr

eate

subV

Is th

at m

odify

VI,

grap

h, o

r cha

rt pr

oper

ties.

Sce

nario

Cre

ate

subV

Is fo

r the

Tem

pera

ture

Lim

it V

I tha

t allo

w y

ou to

han

dle

som

e of

the

func

tiona

lity

that

you

ena

bled

in E

xerc

ise

3-1

and

Exer

cise

3-2.

Impl

emen

tatio

n1.

Ope

n th

e Te

mpe

ratu

re L

imit

VI f

rom

the

Tem

pera

ture

Lim

it Pr

ojec

t loc

ated

in th

e <Exercises>\LabVIEW Core 2\Temp Limit - SubVIs

dire

ctor

y.

2.Th

e bl

ock

diag

ram

, as s

how

n in

Fig

ure

3-10

incl

udes

cod

e to

:

•hi

de sc

roll

bars

whi

le ru

nnin

g

•se

t dia

log

prop

ertie

s

•re

enab

le th

e co

ntro

ls w

hen

you

stop

the

VI

Fig

ure

3-1

0. T

empe

ratu

re L

imit—

Sub

VIs

Sta

rt

Page 92: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-16

In th

is ex

erci

se, y

ou m

odify

the b

lock

dia

gram

to u

se su

bVIs

and

use c

ontro

l ref

eren

ces.

Figu

re3-

11 d

escr

ibes

the s

ubV

Is y

ou cr

eate

and

use t

o m

ake t

he T

empe

ratu

re

Lim

it V

I mor

e m

odul

ar a

nd sc

alab

le.

Fig

ure

3-1

1. T

empe

ratu

re L

imit

VI—

Com

plet

e B

lock

Dia

gram

3.C

reat

e th

e Se

t Scr

oll B

ar S

tate

subV

I.

O

n th

e Te

mpe

ratu

re L

imit

bloc

k di

agra

m, h

ighl

ight

the

code

show

n in

Fig

ure

3-12

and

sele

ct E

dit»

Cre

ate

SubV

I.

Fig

ure

3-1

2. S

et S

crol

l Bar

Sta

te C

ode

to H

ighl

ight

1S

et S

crol

l Bar

Sta

te S

ubV

I—H

ides

the

scro

ll ba

rs w

hen

the

VI r

uns.

2S

et D

ialo

g P

rope

rtie

s S

ubV

I—H

ides

the

tool

bar

and

men

u ba

r w

hen

the

VI r

uns.

3S

et E

nabl

e S

tate

on

Mul

tiple

Con

trol

s V

I—S

ets

all t

he c

ontr

ols

in th

e in

put a

rray

to th

e E

nabl

e st

ate

valu

e.

12

3

Page 93: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

17

4.O

pen

the

subV

I.

D

oubl

e-cl

ick

the

subV

I ico

n on

the

bloc

k di

agra

m to

ope

n an

d m

odify

the

fron

t pan

el o

f the

subV

I you

just

cre

ated

as s

how

n in

Fig

ure

3-13

.

Fig

ure

3-1

3. S

et S

crol

l Bar

Sta

te S

ubV

I Fro

nt P

anel

1P

ane

Ref

Out

Indi

cato

r—C

reat

e a

copy

of t

he P

ane

Ref

In c

ontr

ol. R

ight

-clic

k th

e co

py a

nd s

elec

t Ch

ang

e to

Ind

icat

or

and

chan

ge th

e la

bel.

2A

ssig

n th

e P

ane

Ref

Out

indi

cato

r to

the

top

right

term

inal

of t

he c

onne

ctor

pan

e. C

onne

ctio

ns fo

r th

e ot

her

cont

rols

and

indi

cato

rs s

houl

d al

read

y be

cre

ated

.

1

2

Page 94: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-18

5.M

odify

the

bloc

k di

agra

m o

f the

Set

Scr

oll B

ar S

tate

subV

I as s

how

n in

Fig

ure

3-14

.

Fig

ure

3-1

4. S

et S

crol

l Bar

Sta

te S

ubV

I Blo

ck D

iagr

am

6.W

ire th

e re

fere

nce

and

erro

r wire

s thr

ough

the

Erro

r cas

e.

7.C

reat

e a

mea

ning

ful i

con

for t

he su

bVI a

nd sa

ve it

as S

et Scroll Bar State.vi

in th

e <Exercises>\LabVIEW Core 2\Temp Limit - SubVI

di

rect

ory.

8.C

reat

e th

e Se

t Dia

log

Prop

ertie

s sub

VI.

9.O

n th

e Te

mpe

ratu

re L

imit

VI,

high

light

the

code

show

n in

Fig

ure

3-15

and

sele

ct E

dit»

Cre

ate

SubV

I.

Fig

ure

3-1

5. S

et D

ialo

g P

rope

rtie

s C

ode

to H

ighl

ight

Page 95: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

19

10.O

pen

the

subV

I you

just

cre

ated

and

mod

ify th

e fr

ont p

anel

as s

how

n in

Fig

ure

3-16

.

Fig

ure

3-1

6. S

et D

ialo

g P

rope

rtie

s S

ubV

I Fro

nt P

anel

1V

I Ref

Out

Indi

cato

r—C

reat

e a

copy

of t

he V

I Ref

Con

trol

. Rig

ht-c

lick

the

copy

and

sel

ect C

han

ge

to In

dic

ato

r an

d ch

ange

the

labe

l.

2A

ssig

n th

e V

I Ref

Out

indi

cato

r to

the

top

right

term

inal

of t

he c

onne

ctor

pan

e. C

onne

ctio

ns fo

r th

e ot

her

cont

rols

and

indi

cato

rs s

houl

d al

read

y be

cre

ated

.

1

2

Page 96: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 3

Con

trol

ling

the

Use

r In

terf

ace

ni.c

om|

3-20

Fig

ure

3-1

7. S

et D

ialo

g P

rope

rtie

s S

ubV

I Blo

ck D

iagr

am

11.W

ire th

e re

fere

nce

and

erro

r wire

s thr

ough

the

Erro

r cas

e.

12.C

reat

e a

mea

ning

ful i

con

for t

he su

bVI a

nd sa

ve it

as S

et Dialog Properties.vi

in th

e <Exercises>\LabVIEW Core 2\Temp Limit - SubVI

di

rect

ory.

13.A

dd th

e Se

t Ena

ble

Stat

e on

Mul

tiple

Con

trols

VI t

o th

e bl

ock

diag

ram

of t

he T

empe

ratu

re L

imit

VI.

Th

e Se

t Ena

ble

Stat

e on

Mul

tiple

Con

trols

VI i

s pro

vide

d fo

r you

in th

e Te

mpe

ratu

re L

imit

proj

ect.

D

rag

two

copi

es o

f the

VI f

rom

the

Proj

ect E

xplo

rer W

indo

w o

nto

the

Tem

pera

ture

Lim

it bl

ock

diag

ram

and

com

plet

e th

e bl

ock

diag

ram

as s

how

n in

Fi

gure

3-18

.

1N

ot fu

nctio

n—In

vert

the

logi

c fo

r th

e E

nabl

e D

ialo

g P

rope

rtie

s bu

tton

whe

n w

ired

to th

e pr

oper

ty n

ode

to s

how

the

men

u ba

r an

d to

ol b

ar

1

Page 97: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|3-

21

Fig

ure

3-1

8. T

empe

ratu

re L

imit

Blo

ck D

iagr

am C

ompl

ete

Test

1.R

un th

e Te

mpe

ratu

re L

imit

VI a

nd v

erify

that

it b

ehav

es a

s exp

ecte

d.

2.Sa

ve a

nd c

lose

all

open

VIs

and

the

Tem

pera

ture

Lim

it pr

ojec

t.

End

of E

xerc

ise

3-3

1V

I Ser

ver

Ref

eren

ces—

Cre

ate

refe

renc

es fo

r th

e D

elta

t (m

s) c

ontr

ol, t

he H

igh

Lim

it co

ntro

l, an

d th

e S

tart

but

ton

cont

rol.

R

ight

-clic

k ea

ch o

f the

con

trol

s an

d se

lect

Cre

ate»

Ref

eren

ce.

T

he H

igh

Lim

it co

ntro

l is

in th

e T

imeo

ut e

vent

cas

e.

2B

uild

Arr

ay—

Exp

and

the

node

to a

ccep

t thr

ee in

puts

.

3S

et E

nabl

e S

tate

on

Mul

tiple

Con

trol

s su

bVI—

Cre

ate

a co

py o

f the

sub

VI a

nd th

e D

isab

led

Sta

te c

onst

ant a

nd p

lace

them

in th

e “S

tart

”: V

alue

Cha

nge

even

t ca

se.

2

1

3

Page 98: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 99: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|

4-14

File

I/O

Tec

hniq

ues

Exe

rcis

esEx

erci

se 4

-1C

reat

e Fo

lder

and

File

Exer

cise

4-2

Writ

e M

ultip

le C

hann

els w

ith S

impl

e H

eade

rEx

erci

se 4

-3R

ead

TDM

S Fi

les

Page 100: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 101: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

3

Exe

rcis

e 4-

1C

reat

e F

olde

r an

d F

ile

Goa

lM

odify

a V

I to

prog

ram

atic

ally

cre

ate

a fo

lder

if n

one

exis

ts o

r to

repl

ace

it if

it al

read

y ex

ists

.

Impl

emen

tatio

n1.

Ope

n th

e Create folder and file.lvproj

loca

ted

in th

e <Exercises>\LabVIEW Core 2\Create folder and file

dire

ctor

y.

2.R

ight

-clic

k C

reat

e fol

der a

nd fi

le.lv

proj

in th

e Pro

ject

Exp

lore

r win

dow

and

sele

ct E

xplo

re. N

otic

e the

file

s in

the f

olde

r and

not

ice t

hat t

here

is n

o fo

lder

calle

d Logged Data

.

3.O

pen

Cre

ate

Dat

a Fi

le.v

i fro

m th

e Pr

ojec

t Exp

lore

r win

dow

.

Page 102: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-4

4.Ex

amin

e th

e bl

ock

diag

ram

, as s

how

n in

Fig

ure

4-1. Fig

ure

4-1

. C

reat

e D

ata

File

VI B

lock

Dia

gram

—S

tart

1A

pplic

atio

n D

irect

ory—

Ret

urns

the

path

to th

e di

rect

ory

cont

aini

ng th

e ap

plic

atio

n. T

his

is u

sefu

l bec

ause

you

are

usi

ng a

sub

VI t

o cr

eate

the

data

file

.

2B

uild

Pat

h—A

dds

“Log

ged

Dat

a” to

the

file

path

nam

e.

3C

reat

e F

olde

r—If

the

Logg

ed D

ata

fold

er d

oes

not e

xist

, thi

s fu

nctio

n cr

eate

s it.

4B

uild

Pat

h—T

his

inst

ance

of t

he B

uild

Pat

h fu

nctio

n ap

pend

s th

e au

to g

ener

ated

file

nam

e Acquired Data <Date><Time>.txt

to th

e fil

e pa

th.

5O

pen/

Cre

ate/

Rep

lace

File

—R

epla

ces

or c

reat

es th

e fil

e.

6F

orm

at D

ate/

Tim

e S

trin

g—G

ener

ates

a p

re-f

orm

atte

d st

ring

cont

aini

ng th

e cu

rren

t dat

e an

d tim

e.

7F

orm

at In

to S

trin

g—C

onca

tena

ntes

the

strin

gs to

bui

ld th

e fil

e na

me.

67

12

34

5

Page 103: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

5

5.U

se th

e C

onte

xt H

elp

and

Det

aile

d H

elp

for t

he F

orm

at D

ate/

Tim

e St

ring

func

tion

to id

entif

y th

e m

eani

ng o

f the

tim

e-re

late

d fo

rmat

cod

es u

sed

in th

is V

I.

O

pen

the

Con

text

Hel

p if

it is

not

alre

ady

open

.

M

ove

the

curs

or o

ver t

he F

orm

at D

ate/

Tim

e St

ring

func

tion

and

then

clic

k th

e D

etai

led

Hel

p lin

k in

the

Con

text

Hel

p w

indo

w.

R

ead

the

Form

at D

ate/

Tim

e St

ring

Func

tion

help

topi

c to

lear

n th

e m

eani

ng o

f the

follo

win

g co

des:

•%

b

•%

d

•%

y

•%

H

•%

M

6.R

un th

e V

I to

test

the

func

tiona

lity.

Tu

rn o

n ex

ecut

ion

high

light

ing.

R

un th

e V

I onc

e an

d w

atch

the

flow

of d

ata

on th

e bl

ock

diag

ram

.

O

pen

the <Exercises>\LabVIEW Core 2\Create folder and file

dire

ctor

y an

d no

tice

that

a n

ew fo

lder

nam

ed L

ogge

d D

ata

was

cre

ated

and

co

ntai

ns a

n em

pty

file.

Che

ck th

at th

e fil

enam

e in

clud

es th

e da

te a

nd ti

me

form

atte

d co

mpo

nent

s cre

ated

usi

ng th

e co

des u

sed

in th

e V

I.

7.R

un th

e V

I a se

cond

tim

e.

N

otic

e th

at a

n er

ror o

ccur

s at t

he C

reat

e Fo

lder

func

tion.

O

pen

the f

ront

pan

el, r

ight

-clic

k th

e Err

or O

ut cl

uste

r and

sele

ct E

xpla

in E

rror

. The

erro

r cod

e 10

Dup

licat

e Pat

h is

retu

rned

bec

ause

the f

olde

r alre

ady

exis

ts.

8.M

odify

the

code

to c

heck

if th

e Lo

gged

Dat

a fo

lder

alre

ady

exis

ts a

s sho

wn

in F

igur

e4-

2.

9.O

nly

if th

e fo

lder

doe

s not

exi

st, c

reat

e it.

The

refo

re, y

ou e

nclo

se th

e C

reat

e Fo

lder

func

tion

in a

Cas

e st

ruct

ure.

You

use

the

outp

ut o

f the

Che

ck if

File

or F

olde

r Ex

ists

VI t

o co

nditi

onal

ly c

all t

he C

reat

e Fo

lder

func

tion.

10.M

odify

the

bloc

k di

agra

m to

con

ditio

nally

cre

ate

the

fold

er.

Page 104: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-6

Fig

ure

4-2

. C

reat

e D

ata

File

VI B

lock

Dia

gram

—C

ompl

ete

11.S

ave

the

VI a

nd ru

n it

agai

n. N

otic

e th

at a

new

.txt

file

is c

reat

ed a

nd th

e V

I doe

sn't

retu

rn a

n er

ror.

End

of E

xerc

ise

4-1

1C

heck

if F

ile o

r F

olde

r E

xist

s V

I—C

heck

s to

see

if th

e fil

e or

fold

er e

xist

s an

d ou

tput

s th

is in

form

atio

n to

the

Cre

ate

Fol

der

func

tion.

2C

ase

Str

uctu

re—

Add

a C

ase

Str

uctu

re a

roun

d th

e C

reat

e F

olde

r fun

ctio

n an

d th

en c

lick

the

Cas

e st

ruct

ure

bord

er a

nd s

elec

t Mak

e th

is C

ase

Fal

se. T

he fo

lder

is

cre

ated

onl

y if

it do

es n

ot a

lread

y ex

ist.

W

ire th

e re

fere

nce

and

erro

r w

ires

thro

ugh

the

Tru

e C

ase.

12

Page 105: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

7

Exe

rcis

e 4-

2W

rite

Mul

tiple

Cha

nnel

s w

ith S

impl

e H

eade

r

Goa

lB

uild

coh

esiv

e, m

odul

ar, a

nd re

adab

le V

Is th

at a

llow

for a

pplic

atio

n sc

alab

ility

and

mai

ntai

nabi

lity.

LabV

IEW

arr

ays s

tore

cha

nnel

s in

row

s and

text

file

s typ

ical

ly st

ore

chan

nel d

ata

in c

olum

ns (f

or e

xam

ple,

Exc

el p

refe

rs d

ata

in c

olum

ns).

Use

Lab

VIE

W fu

nctio

ns to

eas

ily c

onve

rt nu

mer

ic a

rray

s int

o st

rings

.

Impl

emen

tatio

n1.

Ope

n th

e Write Multiple Channels with Simple Headers.lvproj

loca

ted

in th

e <Exercises>\LabVIEW Core 2\File IO -

MultiChannel with Header

dire

ctor

y.

2.O

pen

Wri

te M

ultip

le C

hann

els w

ith S

impl

e H

eade

r.vi

from

the

Proj

ect E

xplo

rer w

indo

w a

nd o

pen

the

bloc

k di

agra

m.

This

VI u

ses s

ever

al su

bVIs

in o

rder

to m

odul

ariz

e th

e co

de a

nd m

ake

it m

ore

read

able

. In

this

exe

rcis

e yo

u co

mpl

ete

the

Form

at F

ile P

rope

rty V

I and

the

Mul

tiCha

nnel

Writ

e V

I.

Fig

ure

4-3

. W

rite

Mul

tiple

Cha

nnel

s w

ith S

impl

e H

eade

r V

I Blo

ck D

iagr

am

1F

orm

at F

ile P

rope

rty

VI—

Fou

r in

stan

ces

of th

is V

I are

use

d to

add

Dat

e, T

ime,

Ope

rato

r N

ame,

and

UU

T S

eria

l Num

ber

to th

e fil

e he

ader

.

2C

reat

e D

ata

File

VI—

As

you

saw

in E

xerc

ise

4-1,

this

VI p

rogr

amm

atic

ally

cre

ates

and

sav

es a

file

.

3M

ultiC

hann

el W

rite

VI

1

23

Page 106: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-8

3.Fr

om th

e bl

ock

diag

ram

of t

he W

rite

Mul

tiple

Cha

nnel

s with

Sim

ple

Hea

der V

I, do

uble

-clic

k th

e Fo

rmat

File

Pro

perty

subV

I and

mod

ify th

e bl

ock

diag

ram

as

show

n in

Fig

ure

4-4.

Fig

ure

4-4

. Fo

rmat

File

VI B

lock

Dia

gram

No

teW

hen

you

add

oper

atio

ns to

the

Cur

rent

form

at se

quen

ce in

the

Edit

Form

at S

ting

dial

og b

ox, L

abV

IEW

add

s a sp

ace

betw

een

each

one

by

defa

ult.

You

can

rem

ove

the

spac

es in

the

Cor

resp

ondi

ng fo

rmat

stri

ng se

ctio

n of

the

dial

og b

ox.

4.Sa

ve a

nd c

lose

the

Form

at F

ile P

rope

rty V

I.

1T

ab C

onst

ant

2E

nd o

f Lin

e C

onst

ant

3F

orm

at In

to S

trin

g—D

oubl

e-cl

ick

the

node

to o

pen

the

Edi

t Str

ing

For

mat

dia

log

box

and

sele

ct F

orm

at s

trin

g (

abc)

from

the

Sel

ecte

d o

per

atio

n (

exam

ple

) pu

ll-do

wn

men

u.

C

lick

the

Ad

d N

ew O

per

atio

n b

utto

n th

ree

times

to a

dd th

ree

mor

e F

orm

at s

trin

g op

erat

ions

to th

e C

urr

ent

form

at s

equ

ence

list

box.

C

lick

OK

to c

lose

the

dial

og b

ox.

N

otic

e th

at th

e F

orm

at In

to S

trin

g fu

nctio

n no

w h

as fo

ur in

puts

to c

orre

spon

d to

the

four

ope

ratio

ns y

ou a

dded

.

21

3

Page 107: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

9

5.Fr

om th

e bl

ock

diag

ram

of t

he W

rite

Mul

tiple

Cha

nnel

s with

Sim

ple

Hea

der V

I, do

uble

-clic

k th

e M

ultiC

hann

el W

rite

subV

I and

com

plet

e th

e N

o Er

ror c

ase,

as

show

n in

Fig

ure

4-5.

Fig

ure

4-5

. M

ultiC

hann

el W

rite

Sub

VI B

lock

Dia

gram

6.Sa

ve a

nd c

lose

the

Mul

tiCha

nnel

Writ

e V

I.

Test

1.R

un th

e W

rite

Mul

tiple

Cha

nnel

s with

Sim

ple

Hea

der V

I and

cre

ate

a da

ta fi

le.

This

VI u

ses t

he C

reat

e D

ata

File

VI t

hat y

ou u

sed

in E

xerc

ise

4-1

to p

rogr

amm

atic

ally

cre

ate

the

Logg

ed D

ata

dire

ctor

y an

d th

e da

ta fi

le in

the

sam

e di

rect

ory

cont

aini

ng th

e ap

plic

atio

n.

1T

rans

pose

2D

Arr

ay—

Bec

ause

Lab

VIE

W s

tore

s ar

ray

data

in r

ows

by d

efau

lt, th

is fu

nctio

n tr

ansp

oses

you

r ar

ray

to w

rite

the

data

into

col

umns

.

2A

rray

to S

prea

dshe

et S

trin

g—C

onve

rts

the

arra

y to

a ta

ble

in s

trin

g fo

rm.

3W

rite

to T

ext F

ile—

Writ

es a

str

ing

or a

n ar

ray

of s

trin

gs to

line

s in

a fi

le.

1

3

2

Page 108: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-10

2.A

dd th

e Lo

gged

Dat

a di

rect

ory

to y

our p

roje

ct.

In

the

Writ

e M

ultip

le C

hann

els w

ith S

impl

e H

eade

r Lab

VIE

W P

roje

ct E

xplo

rer w

indo

w, r

ight

-clic

k M

y C

ompu

ter

and

sele

ct A

dd»F

olde

r (A

uto-

popu

latin

g).

N

avig

ate

to <Exercises>\LabVIEW Core 2\File IO - MultiChannel with Header\Logged Data

and

clic

k th

e Se

lect

Fol

der

butto

n.

O

pen

the Logged Data

dire

ctor

y fr

om th

e La

bVIE

W P

roje

ct E

xplo

rer w

indo

w a

nd n

otic

e th

at it

con

tain

s the

file

you

cre

ated

whe

n yo

u ra

n th

e Sa

ve

Mul

tiple

Cha

nnel

s with

Sim

ple

Hea

der V

I.

O

pen

and

exam

ine

the

gene

rate

d fil

e in

the

Logg

ed D

ata

dire

ctor

y.

3.R

ead

the

data

file

.

R

un th

e R

ead

Mul

tiple

Cha

nnel

s with

Sim

ple

Hea

der V

I.

N

avig

ate

to <Exercises>\LabVIEW Core 2\File IO - MultiChannel with Header\Logged Data

and

sele

ct th

e da

ta fi

le y

ou ju

st c

reat

ed.

4.Sa

ve a

nd c

lose

all

open

VIs

. Sav

e an

d cl

ose

the

Writ

e M

ultip

le C

hann

els w

ith S

impl

e H

eade

r pro

ject

.

Page 109: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

11

Cha

lleng

e 4-

2A

Goa

lC

reat

e a

VI t

hat t

akes

the

prop

erty

nam

e as

inpu

t and

retu

rns t

he a

ssoc

iate

d pr

oper

ty v

alue

.

Sce

nario

Supp

ose

your

file

hea

der i

nclu

des a

var

iabl

e nu

mbe

r of p

rope

rty n

ames

and

val

ues.

Afte

r rea

ding

in th

e fil

e, y

ou w

ant t

o pr

ogra

mm

atic

ally

acc

ess t

he p

rope

rty v

alue

fo

r a g

iven

pro

perty

. For

exa

mpl

e, in

this

exe

rcis

e, o

ne o

f the

pro

perti

es w

as “

UU

T Se

rial N

umbe

r”. Y

ou w

ant t

o pr

ogra

mm

atic

ally

sear

ch fo

r “U

UT

Seria

l Num

ber”

an

d th

en re

turn

the

seria

l num

ber v

alue

(e.g

., “A

1234

5”).

Des

crip

tion

Afte

r rea

ding

the

spre

adsh

eet s

tring

into

mem

ory,

use

a m

odul

ar a

ppro

ach

to c

reat

e a

VI w

hich

find

s the

row

inde

x of

a p

rope

rty n

ame.

The

n us

e th

e ro

w in

dex

to

retu

rn th

e pr

oper

ty v

alue

. If t

he p

rope

rty n

ame

isn'

t fou

nd, t

he V

I sho

uld

retu

rn a

des

crip

tive

erro

r.

Cha

lleng

e 4-

2B

Goa

lC

reat

e a

VI t

hat c

reat

es ta

b de

limite

d co

lum

n he

ader

s for

an

arbi

trary

num

ber o

f cha

nnel

s.

Sce

nario

The

Mul

tiCha

nnel

Writ

e V

I can

writ

e da

ta fo

r an

arbi

trary

num

ber o

f cha

nnel

s usi

ng a

two

dim

ensi

onal

arr

ay. Y

ou w

ant t

o cr

eate

a c

hann

el h

eade

r for

eac

h ch

anne

l of

dat

a. S

ince

the

num

ber o

f cha

nnel

s is a

rbitr

ary,

you

nee

d a

scal

able

app

roac

h w

hich

allo

ws f

or a

var

iabl

e nu

mbe

r of c

hann

el h

eade

rs. F

or e

xam

ple,

if y

ou h

ave

3ch

anne

ls o

f dat

a—te

mpe

ratu

re, p

ress

ure,

and

stra

in—

you

wan

t to

writ

e th

e da

ta to

file

with

the

follo

win

g he

ader

s Tem

pera

ture

, Pre

ssur

e, a

nd S

train

. For

the

file

to

be fo

rmat

ted

corr

ectly

, you

wan

t the

sam

e de

limite

rs to

be

used

in th

e he

ader

as i

s use

d fo

r the

cha

nnel

dat

a. F

or e

xam

ple,

if th

e ch

anne

l dat

a is

tab

delim

ited

with

ea

ch li

ne te

rmin

ated

with

an

end-

of-li

ne c

hara

cter

, you

wan

t you

r hea

der t

o be

form

atte

d th

e sa

me

way

.

Des

crip

tion

Cre

ate

a W

rite

Cha

nnel

with

Hea

ders

VI w

hich

you

cal

l prio

r to

your

Mul

tiCha

nnel

Writ

e V

I tha

t writ

es a

cha

nnel

hea

der f

or e

ach

chan

nel o

f dat

a. T

he V

I sho

uld

take

an

arra

y of

strin

gs a

s inp

ut. Y

our s

ubV

I sho

uld

writ

e th

e st

rings

to fi

le so

that

a ta

b se

para

tes e

ach

strin

g an

d th

e lin

e is

term

inat

ed b

y an

end

-of-

line

char

acte

r.

End

of E

xerc

ise

4-2

Page 110: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 111: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

13

Exe

rcis

e 4-

3R

ead

TD

MS

File

s

Goa

lLo

g da

ta to

a T

DM

S fil

e an

d re

ad th

e sa

me

TDM

S fil

e to

acc

ess i

nfor

mat

ion

abou

t a sp

ecifi

c ch

anne

l.

Sce

nario

You

are g

iven

a TD

MS

Logg

er V

I tha

t gen

erat

es m

easu

rem

ent d

ata f

or an

y nu

mbe

r of u

nits

und

er te

st (U

UTs

). Th

e UU

T m

easu

rem

ent d

ata c

onsi

sts o

f a ti

me d

omai

n w

avef

orm

and

the

pow

er sp

ectru

m o

f a w

avef

orm

.

Run

the

TDM

S Lo

gger

VI t

hat a

ccep

ts U

UTs

iden

tifie

d by

seria

l num

bers

. The

TD

MS

Logg

er V

I ret

rieve

s the

mea

sure

men

t dat

a fr

om th

e G

ener

ate

Dat

a V

I, an

d lo

gs th

e U

UT

data

and

add

ition

al p

rope

rties

to a

TD

MS

file.

The

TDM

S fil

e co

ntai

ns th

e au

thor

, tim

esta

mp,

and

two

chan

nel g

roup

s—Ti

me

Dat

a an

d Po

wer

Spe

ctru

m D

ata.

Eac

h gr

oup

cont

ains

a c

hann

el fo

r eac

h U

UT.

The

se

rial n

umbe

r of t

he U

UT

nam

es e

ach

chan

nel a

nd c

onta

ins t

he m

atch

ing

sign

al d

ata.

Savi

ng d

ata

to a

file

serv

es n

o pu

rpos

e un

less

you

als

o ca

n ac

cess

the

data

. Cre

ate

a re

ader

VI t

o ac

cess

dat

a fr

om th

e TD

MS

file

you

gene

rate

d. T

he re

ader

shou

ld

retu

rn e

ither

tim

e da

ta o

r pow

er sp

ectru

m d

ata

for a

par

ticul

ar U

UT

seria

l num

ber.

No

teO

ptio

nally

, if y

ou h

ave M

icro

soft

Exce

l ins

talle

d on

you

r sys

tem

you

can

use t

he T

DM

Exc

el A

dd-I

n to

ol to

load

the

TDM

S fil

e int

o M

icro

soft

Exce

l.

Des

ign

TD

MS

File

Ref

eren

ce In

form

atio

n

•Fi

le L

evel

Info

rmat

ion

–T

ime

Stam

p—co

ntai

ns th

e cu

rren

t tim

e.

–A

utho

r—co

ntai

ns th

e te

st o

pera

tor n

ame,

acq

uire

d th

roug

h a

fron

t pan

el c

ontro

l.

–Th

e fil

e co

ntai

ns tw

o ch

anne

l gro

ups,

one

for t

ime

data

and

one

for t

he p

ower

spec

trum

dat

a.

•C

hann

el G

roup

Lev

el In

form

atio

n

–N

ame—

cont

ains

Time Data

or P

ower Spectrum Data

. Thi

s ide

ntifi

es th

e ch

anne

l gro

up.

–Ea

ch c

hann

el g

roup

shou

ld c

onta

in a

cha

nnel

for e

ach

UU

T.

Page 112: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-14

•C

hann

el L

evel

Info

rmat

ion

–N

ame—

cont

ains

the

UU

T Se

rial N

umbe

r, w

hich

ass

ocia

tes t

he n

umer

ic d

ata

with

a p

artic

ular

uni

t.

–Si

gnal

—co

ntai

ns a

n ar

ray

of fl

oatin

g-po

int n

umer

ic d

ata.

–Se

vera

l oth

er p

rope

rties

, suc

h as

the

sign

al m

inim

um a

nd m

axim

um w

ill a

utom

atic

ally

be

calc

ulat

ed a

nd a

dded

to th

e fil

e.

TD

MS

Rea

der

Inpu

ts a

nd O

utpu

ts

Your

VI s

houl

d be

gin

by o

peni

ng th

e TD

MS

file a

nd re

adin

g th

e aut

hor a

nd ti

me s

tam

p fil

e pro

perti

es. T

hen

read

the t

ime d

ata o

r pow

er sp

ectru

m d

ata f

or th

e spe

cifie

d U

UT

and

disp

lay

the

data

on

the

Cha

nnel

Dat

a w

avef

orm

gra

ph.

Tab

le 4

-1.

TD

MS

Rea

der

VI I

nput

s an

d O

utpu

ts

Typ

eN

ame

Pro

per

ties

Strin

g C

ontro

lSerial Number

Com

bo B

oxData Set

Item

1 =

“Ti

me

Dat

a”Ite

m 2

= “

Pow

er S

pect

rum

Wav

efor

m G

raph

Indi

cato

rChannel Data

Strin

g In

dica

tor

Test Operator

Tim

e St

amp

Indi

cato

rTime of Test

Page 113: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

15

Impl

emen

tatio

n

TD

MS

Log

ger

1.O

pen TDMS Logger.vi

from

the

TDM

S Lo

gger

and

Rea

der P

roje

ct lo

cate

d in

the <Exercises>\LabVIEW Core 2\TDMS Logger and Reader

dire

ctor

y. T

his V

I is p

re-b

uilt

for y

ou a

s sho

wn

in F

igur

e4-

6.

Fig

ure

4-6

. T

DM

S L

ogge

r Fr

ont P

anel

Page 114: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-16

2.Te

st th

e TD

MS

Logg

er V

I.

En

ter y

our n

ame

in th

e T

est O

pera

tor

field

.

En

ter A

001

, A002

, and

A003

in th

e U

UT

Ser

ial N

umbe

rs c

ontro

l.

R

un th

e TD

MS

Logg

er V

I and

save

the

file

as test.tdms

in th

e <Exercises>\LabVIEW Core 2\TDMS Logger and Reader

dire

ctor

y.W

hen

you

save

the

TDM

S fil

e, th

e TD

MS

File

Vie

w w

indo

w o

pens

.

V

iew

the

logg

ed d

ata

in th

e TD

MS

File

Vie

wer

win

dow

.

Ex

pand

the

test

.tdm

s ite

m in

the

File

Con

tent

s pan

e of

the

win

dow

and

then

exp

and

the

Tim

e D

ata

and

Pow

er S

pect

rum

item

s and

vie

w th

e sa

mpl

e da

ta

for e

ach

of th

e U

UT

seria

l num

bers

you

ent

ered

.

C

lick

Qui

t to

clos

e th

e TD

MS

File

Vie

wer

win

dow

.

V

iew

the

fron

t pan

el o

f the

TD

MS

Logg

er V

I, w

hich

als

o di

spla

ys a

plo

t for

eac

h se

rial n

umbe

r you

ent

er.

Ex

amin

e th

e bl

ock

diag

ram

.

C

lose

the

TDM

S Lo

gger

VI.

Do

not s

ave

any

chan

ges.

Page 115: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

17

TD

MS

Rea

der

VI

1.O

pen

the

TDM

S R

eade

r VI f

rom

the

Proj

ect E

xplo

rer w

indo

w o

f the

TD

MS

Logg

er a

nd R

eade

r pro

ject

.

2.Th

e fr

ont p

anel

is sh

own

in F

igur

e4-

7.

Fig

ure

4-7

. T

DM

S R

eade

r Fr

ont P

anel

Page 116: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-18

3.O

pen

and

exam

ine

the

bloc

k di

agra

m a

s sho

wn

in F

igur

e4-

8

Fig

ure

4-8

. T

DM

S R

eade

r B

lock

Dia

gram

1A

pplic

atio

n D

irect

ory

VI—

Ret

urns

the

path

to th

e di

rect

ory

cont

aini

ng th

e ap

plic

atio

n.

2F

ile D

ialo

g E

xpre

ss V

I—T

his

VI i

s co

nfig

ured

with

the

follo

win

g op

tions

:

Li

mit

sele

ctio

n to

sin

gle

item

F

ile—

The

use

r ca

n on

ly s

elec

t a fi

le

E

xist

ing—

The

use

r ca

n on

ly s

elec

t an

exis

ting

file

or fo

lder

3T

DM

S O

pen—

Ope

n a

.tdm

s fil

e fo

r re

adin

g or

writ

ing.

4O

pen

cons

tant

—R

ight

-clic

k th

e op

erat

ion

inpu

t of t

he T

DM

S O

pen

func

tion

and

sele

ct C

reat

e»C

on

stan

t.

5T

DM

S G

et P

rope

rtie

s—T

his

inst

ance

of t

he T

DM

S G

et P

rope

rtie

s fu

nctio

n re

ads

the

Aut

hor

file

prop

erty

.

6T

ime

Sta

mp

Con

stan

t—P

asse

s tim

e an

d da

te v

alue

to th

e bl

ock

diag

ram

.

7T

DM

S G

et P

rope

rtie

s—T

his

inst

ance

of t

he T

DM

S G

et P

rope

rtie

s fu

nctio

n re

ads

the

Tim

e S

tam

p fil

e pr

oper

ty.

8T

DM

S R

ead—

Rea

ds th

e tim

e da

ta o

r po

wer

spe

ctru

m d

ata

for

the

spec

ified

UU

T a

nd d

ispl

ays

the

data

on

the

Wav

efor

m G

raph

.

9T

DM

S C

lose

1

34

2

89

6

7

5

Page 117: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|4-

19

Test

1.R

ead

and

disp

lay

the

time

dom

ain

data

.

O

n th

e V

I fro

nt p

anel

, ens

ure

that

the

Dat

a Se

t is s

et to

Tim

e D

ata.

En

ter A

001

in th

e Se

rial

Num

ber

cont

rol.

No

teA001

was

one

of t

he se

rial n

umbe

rs y

ou e

nter

ed w

hen

you

ran

the

TDM

S Lo

gger

VI.

R

un th

e V

I and

sele

ct th

e te

st.td

ms f

ile y

ou sa

ved

in <Exercises>\LabVIEW Core 2\TDMS Logger and Reader

. The

follo

win

g in

form

atio

n is

di

spla

yed

on th

e fr

ont p

anel

:

–W

avef

orm

Gra

ph—

sine

wav

e

–Te

st O

pera

tor—

your

nam

e

–Ti

me

of T

est—

time

stam

p fr

om w

hen

you

ran

the

TDM

S R

eade

r

C

hang

e th

e Se

rial N

umbe

r to A002

.

R

un th

e V

I. A

diff

eren

t sin

e w

ave

shou

ld d

ispl

ay.

2.R

ead

and

disp

lay

the

pow

er sp

ectru

m d

ata.

C

hang

e th

e D

ata

Set c

ontro

l to

Pow

er S

pect

rum

.

R

un th

e V

I and

sele

ct y

our T

DM

S fil

e. P

ower

spec

trum

dat

a sh

ould

dis

play

in th

e W

avef

orm

Gra

ph.

3.C

lose

the

VI.

Page 118: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 4

File

I/O

Tec

hniq

ues

ni.c

om|

4-20

TD

M E

xcel

Add

-In

(Opt

iona

l)

No

teTh

is e

xerc

ise

requ

ires M

icro

soft

Exce

l ver

sion

200

3 or

200

7 an

d th

e TD

M A

dd-in

Too

l ava

ilabl

e on

ni.com

.

1.La

unch

Mic

roso

ft Ex

cel.

2.C

lick

the

Add

-Ins

tab

and

sele

ct th

e T

DM

Impo

rter

: Im

port

a T

DM

(S) F

ile ic

on in

the

Cus

tom

Too

lbar

s sec

tion.

3.B

row

se to

find

the T

DM

S fil

e you

crea

ted

earli

er: <Exercises>\LabVIEW Core 2\TDMS Logger and Reader\test.tdms

. The

pro

perty

info

rmat

ion

is d

ispl

ayed

on

the

first

wor

kshe

et. T

he T

ime

data

and

Pow

er S

pect

rum

dat

a ar

e di

spla

yed

on se

para

te w

orks

heet

s.

4.Ex

it M

icro

soft

Exce

l and

retu

rn to

Lab

VIE

W.

End

of E

xerc

ise

4-3

Page 119: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|

5-15

Impr

ovin

g an

Exi

stin

g V

I

Exe

rcis

e 5-

1C

once

pt: R

efac

torin

g In

herit

ed C

ode

This

exe

rcis

e co

nsis

ts o

f fiv

e V

Is th

at y

ou w

ill e

valu

ate

for w

ays t

o im

prov

e. L

ook

over

eac

h op

tion

and

choo

se o

ne o

r tw

o to

com

plet

e du

ring

the

time

allo

tted

in

clas

s. Th

e op

tions

for c

ode

to p

ract

ice

refa

ctor

ing

are

liste

d fr

om e

asie

st to

har

dest

.

Sele

ct fr

om th

e fo

llow

ing

optio

ns to

pra

ctic

e re

fact

orin

g La

bVIE

W c

ode:

•Su

bVIs

to F

or L

oops

•A

rray

Man

ipul

atio

n V

I

•Po

lling

to E

vent

s

•Fo

rmat

Into

Stri

ng

•St

ring

Form

attin

g

Page 120: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 121: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|5-

3

Sub

VIs

to F

or L

oops

Goa

lTo

take

an

exis

ting

VI a

nd m

ake

it m

ore

read

able

, sca

labl

e an

d m

aint

aina

ble.

Des

crip

tion

In th

e co

urse

of t

he d

evel

opm

ent o

f a L

abV

IEW

app

licat

ion

ther

e ar

e tim

es w

hen

VIs

or s

ectio

ns o

f VIs

end

up

bein

g w

ritte

n “b

adly

”.

Sce

nario

Your

cus

tom

er is

a re

sear

ch fa

cilit

y th

at is

doi

ng e

xper

imen

ts o

n su

perc

ondu

ctin

g m

ater

ial.

The

rese

arch

ers m

ust p

erfo

rm e

xper

imen

ts a

t ver

y lo

w te

mpe

ratu

res.

The

mat

eria

ls a

re te

sted

in a

cha

mbe

r tha

t con

tain

s fou

r tem

pera

ture

sens

ors s

prea

d th

roug

hout

the

cham

ber.

The

sens

ors r

etur

n te

mpe

ratu

res i

n °C

. Due

to th

e lo

w

tem

pera

ture

s inv

olve

d, th

e tem

pera

ture

s in

°C ar

e les

s rea

dabl

e tha

n °K

. For

this

reas

on th

e cus

tom

er’s

appl

icat

ion

alre

ady

incl

udes

a V

I tha

t con

verts

the t

empe

ratu

res

from

°C to

°K.

The

cust

omer

has

rece

ntly

dec

ided

to m

onito

r mor

e th

an fo

ur te

mpe

ratu

res.

He

is w

orrie

d th

at e

very

tim

e he

incr

ease

s the

num

ber o

f tem

pera

ture

s he

wou

ld h

ave

to

upda

te th

e V

I tha

t doe

s the

con

vers

ion.

In th

is e

xerc

ise

you

will

refa

ctor

the

conv

ersi

on V

I to

mak

e it

mor

e sc

alab

le. Y

ou a

lso

will

mak

e th

e V

I mor

e re

adab

le a

nd

mai

ntai

nabl

e.

No

teTh

e K

elvi

n sc

ale

defin

es A

bsol

ute

Zero

as t

he lo

wes

t tem

pera

ture

pos

sibl

e. N

o te

mpe

ratu

re b

elow

Abs

olut

e Ze

ro is

allo

wed

. Abs

olut

e Ze

ro is

ap

prox

imat

ely

equa

l to

–273

°C. Y

ou sh

ould

bui

ld y

our r

efac

tore

d ap

plic

atio

n to

gen

erat

e err

ors i

f the

use

r trie

s to

conv

ert i

nval

id te

mpe

ratu

res,

for e

xam

ple,

te

mpe

ratu

res l

ess t

han

–273

°C.

Ope

n th

e C

onve

rt Te

mpe

ratu

res V

I loc

ated

in th

e <Exercises>\LabVIEW Core 2\Refactoring\Use subVIs_ForLoop

.

Hin

ts•

Find

repe

ated

cod

e an

d re

plac

e it

with

subV

Is.

•Fi

nd c

ode

that

wor

ks o

n a

limite

d nu

mbe

r of e

lem

ents

of a

n ar

ray

and

scal

e it

to w

ork

on a

n un

limite

d nu

mbe

r of e

lem

ents

.•

Cle

anup

a V

I to

mak

e it

read

able

.•

Org

aniz

e su

bVIs

and

rela

ted

files

in a

pro

ject

.

Test

Test

you

r ref

acto

red

code

to e

nsur

e th

at it

wor

ks a

s the

orig

inal

app

licat

ion

did.

Als

o en

sure

that

the

refa

ctor

ed a

pplic

atio

n ge

nera

tes e

rror

s if t

he u

ser t

ries t

o co

nver

t in

valid

tem

pera

ture

s.

Page 122: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 5

Impr

ovin

g an

Exi

stin

g V

Ini

.com

|5-

4

Arr

ay M

anip

ulat

ion

VI

Goa

lR

efac

tor a

VI t

hat u

ses a

n ou

tdat

ed te

chni

que

for c

ondi

tiona

lly se

para

ting

an a

rray

into

mul

tiple

arr

ays.

Des

crip

tion

Each

rele

ase

of L

abV

IEW

intro

duce

s new

feat

ures

that

impr

ove

codi

ng e

ffici

enci

es. T

here

fore

, you

mig

ht re

fact

or c

ode

you

inhe

rited

from

som

eone

who

dev

elop

ed

the

code

in a

n ea

rlier

ver

sion

of L

abV

IEW

.

Impl

emen

tatio

n1.

Ope

n Separate Array Values.vi

from

the

Arr

ay M

anip

ulat

ion

proj

ect l

ocat

ed in

the <Exercises>\LabVIEW Core 2\Refactoring\Array

Manipulation

dire

ctor

y.

2.Te

st th

e V

I.

Not

ice

that

the

inpu

t arr

ay c

onta

ins a

mix

of p

ositi

ve a

nd n

egat

ive

valu

es. A

fter r

unni

ng, t

he P

ositi

ve A

rray

con

tain

s pos

itive

val

ues w

hile

the

Neg

ativ

e A

rray

co

ntai

ns n

egat

ive

valu

es.

Hin

tsC

ondi

tiona

l aut

o-in

dexi

ng a

llow

s you

to c

ondi

tiona

lly b

uild

an

arra

y w

ithin

a F

or L

oop.

Page 123: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|5-

5

Pol

ling

to E

vent

s

Goa

lTo

take

an

exis

ting

VI t

hat u

ses o

utda

ted

tech

niqu

es a

nd re

fact

or it

to b

e m

ore

read

able

, sca

labl

e an

d m

aint

aina

ble.

Des

crip

tion

A lo

t of e

xist

ing

LabV

IEW

cod

e w

as w

ritte

n us

ing

prac

tices

whi

ch w

ere

stan

dard

and

acc

epte

d in

the

past

but

whi

ch w

ere

disc

over

ed to

be

less

than

idea

l in

term

s of

read

abili

ty, s

cala

bilit

y an

d m

aint

aina

bilit

y.

Sce

nario

You

inhe

rit a

n ol

d La

bVIE

W a

pplic

atio

n w

hich

per

form

s the

follo

win

g fu

nctio

ns:

1.A

cqui

re a

wav

efor

m a

s a T

ime

Serie

s.

2.C

alcu

late

the

FFT

of th

e w

avef

orm

(tha

t is,

gene

rate

the

Spec

trum

).

3.C

alcu

late

the

Max

and

Min

val

ues o

f the

Wav

efor

m.

The

wav

efor

m a

nd sp

ectru

m a

re d

ispl

ayed

in se

para

te W

avef

orm

Gra

ph in

dica

tors

as a

re th

e M

ax a

nd M

in v

alue

s.

You

are

aske

d to

add

a fe

atur

e to

cal

cula

te th

e St

anda

rd D

evia

tion

of th

e Ti

me

Serie

s. Yo

u no

tice

that

the

Blo

ck D

iagr

am o

f the

VI i

s bui

lt in

such

a w

ay th

at a

ddin

g m

ore

feat

ures

mak

es it

gro

w.

Ope

n th

e W

avef

orm

Ana

lysi

s (Po

lling

) VI l

ocat

ed in

the <Exercises>\LabVIEW Core 2\Refactoring\Polling to Events

dire

ctor

y.

Hin

ts

•U

se E

vent

s ins

tead

of P

ollin

g.

•U

se S

hift

Reg

iste

rs in

stea

d of

Loc

al V

aria

bles

.

•U

se a

Pro

ject

to o

rgan

ize

the

files

.

Page 124: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 5

Impr

ovin

g an

Exi

stin

g V

Ini

.com

|5-

6

For

mat

Into

Str

ing

Goa

lR

efac

tor a

VI t

hat u

ses t

he F

orm

at In

to S

tring

func

tion

to m

ake

the

VI m

ore

scal

able

.

Des

crip

tion

The

Form

at In

to S

tring

func

tion

is v

ery

vers

atile

: it c

onve

rts m

ultip

le p

iece

s of d

ata

into

a st

ring

acco

rdin

g to

a fo

rmat

strin

g. H

owev

er, i

f new

par

amet

ers a

re

intro

duce

d, b

oth

the

Form

at In

to S

tring

func

tion

and

the

form

at st

ring

mus

t be

mod

ified

.

You

can

add

para

met

ers w

ithou

t cha

ngin

g th

e V

I if a

ll th

e pa

ram

eter

s are

of t

he sa

me

data

type

.

Impl

emen

tatio

n1.

Ope

n Format Gas Params.vi

from

the F

orm

at G

as P

aram

eter

s pro

ject

loca

ted

in th

e <Exercises>\LabVIEW Core 2\Refactoring\Format Into

String

dire

ctor

y.

A

ssum

e yo

u ne

ed to

add

a n

ew D

BL

para

met

er (f

or e

xam

ple,

Exp

losi

vene

ss).

N

otic

e th

at th

e Fo

rmat

Into

Stri

ng n

ode

need

s to

be e

xpan

ded.

A

lso

notic

e th

at th

e fo

rmat

strin

g ne

eds t

o ha

ve \r\nExplosiveness:\s%f

add

ed.

Hin

tsIf

an

addi

tiona

l par

amet

er n

eeds

to b

e ad

ded

to th

e R

esul

t stri

ng la

ter,

and

arra

y of

par

amet

er v

alue

s mak

es it

eas

y to

add

the

new

nam

e.

Page 125: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|5-

7

Str

ing

For

mat

ting

Goa

lR

efac

tor a

VI t

hat u

ses t

he F

orm

at In

to S

tring

func

tion

to m

ake

it m

ore

scal

able

.

Des

crip

tion

The

Form

at In

to S

tring

func

tion

is v

ery

vers

atile

: it c

onve

rts m

ultip

le p

iece

s of d

ata

into

a st

ring

acco

rdin

g to

a fo

rmat

strin

g. H

owev

er, i

f new

par

amet

ers a

re

intro

duce

d, b

oth

the

Form

at In

to S

tring

and

the

form

at st

ring

mus

t be

mod

ified

.

Sce

nario

You

inhe

rited

som

e co

de th

at c

reat

es a

file

hea

der a

nd in

clud

es a

serie

s of n

ame-

valu

e pa

irs fo

r you

r tes

t dat

a. B

ecau

se th

e fil

e is

exp

ecte

d to

be

load

ed in

to E

xcel

, ea

ch n

ame

and

valu

e is

sepa

rate

d by

a ta

b an

d te

rmin

ated

with

an

End

of L

ine

char

acte

r. In

add

ition

to ti

me

and

date

info

rmat

ion,

the

file

head

er a

lso

incl

udes

in

form

atio

n co

ntai

ned

in a

clu

ster

. The

clu

ster

ele

men

t nam

es a

nd v

alue

s are

use

d in

the

nam

e-va

lue

pairs

.

Your

man

ager

wan

ts to

re-o

rder

the

nam

e-va

lue

pairs

so th

at D

ate

and

Tim

e ap

pear

firs

t. In

the

futu

re y

ou m

ay w

ant t

o ex

pand

the

num

ber o

f ele

men

ts in

the

File

H

eade

r Dat

a cl

uste

r fro

m 3

ele

men

ts to

10

elem

ents

. You

mus

t upd

ate

the

code

to c

hang

e th

e or

der a

nd p

repa

re fo

r fut

ure

scal

abili

ty o

f the

clu

ster

ele

men

ts.

Impl

emen

tatio

nO

pen

the

Gen

erat

e Fi

le H

eade

r VI i

n th

e Fo

rmat

File

Hea

der p

roje

ct lo

cate

d in

the <Exercises>\LabVIEW Core 2\Refactoring\String Formatting

di

rect

ory.

Hin

ts:

•C

reat

e a

subV

I whi

ch fo

rmat

s eac

h na

me-

valu

e pa

ir. S

epar

ate

the

nam

e an

d va

lue

usin

g a

Tab

cons

tant

and

term

inat

e w

ith th

e En

d of

Lin

e co

nsta

nt.

•Th

en p

roce

ss a

list

of n

ame-

valu

e pa

irs. T

he c

halle

nge

is to

cre

ate

two

para

llel a

rray

s, on

e fo

r nam

es a

nd o

ne fo

r val

ues.

•If

all

clus

ter e

lem

ents

are

of t

he sa

me

data

type

, you

can

con

vert

a cl

uste

r to

an a

rray

usi

ng th

e C

lust

er to

Arr

ay fu

nctio

n. Y

ou c

an th

en u

se a

For

Loo

p to

pro

cess

ea

ch c

lust

er e

lem

ent.

•U

se a

con

trol p

rope

rty n

ode

to g

et a

list

of c

ontro

l ref

eren

ces t

o al

l the

clu

ster

ele

men

ts. Y

ou c

an th

en g

et a

cces

s to

the

Labe

l nam

es o

f the

clu

ster

ele

men

ts. U

se

that

to b

uild

an

arra

y of

nam

es.

End

of E

xerc

ise

5-1

Page 126: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 127: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|

6-16

Cre

atin

g an

d D

istr

ibut

ing

App

licat

ions

Exe

rcis

esEx

erci

se 6

-1A

Prep

arin

g Fi

les f

or D

istri

butio

nEx

erci

se 6

-1B

Cre

atin

g an

d D

ebug

ging

a S

tand

-Alo

ne A

pplic

atio

nEx

erci

se 6

-1C

Bui

ldin

g an

Inst

alle

r and

Deb

uggi

ng o

n a

Rem

ote

Mac

hine

Page 128: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 129: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

3

Exe

rcis

e 6-

1AP

repa

ring

File

s fo

r D

istr

ibut

ion

Goa

lR

evie

w th

e B

uild

ing

App

licat

ions

Che

cklis

t and

pre

pare

VIs

to b

uild

a st

and-

alon

e ap

plic

atio

n.

Sce

nario

Rev

iew

the

Bui

ldin

g A

pplic

atio

ns C

heck

list t

o as

sist

you

in th

e bu

ild p

roce

ss b

efor

e cr

eatin

g a

stan

d-al

one

appl

icat

ion

or in

stal

ler.

Stan

d-al

one

appl

icat

ions

in L

abV

IEW

hav

e th

e W

indo

w A

ppea

ranc

e se

t to

Top

-leve

l app

licat

ion

to e

nabl

e th

e fr

ont p

anel

to o

pen

whe

n th

e V

I run

s.

A V

I tha

t run

s as a

stan

d-al

one

exec

utab

le re

mai

ns in

mem

ory

whe

n th

e ap

plic

atio

n fin

ishe

s run

ning

. The

refo

re, i

t is n

eces

sary

to c

all t

he Q

uit L

abV

IEW

func

tion

to

clos

e th

e ap

plic

atio

n w

hen

the

appl

icat

ion

finis

hes e

xecu

ting.

Pla

cing

the

Qui

t Lab

VIE

W fu

nctio

n on

the

bloc

k di

agra

m c

an m

ake

editi

ng th

e ap

plic

atio

n m

ore

diffi

cult

in th

e fut

ure b

ecau

se L

abV

IEW

exits

each

tim

e the

appl

icat

ion

finis

hes.

By

usin

g a P

rope

rty N

ode w

ith th

e App

.Kin

d pr

oper

ty, y

ou ca

n sp

ecify

that

Lab

VIE

W

exits

onl

y w

hen

exec

uted

with

in th

e ru

n-tim

e sy

stem

.

Des

ign

•M

odify

the

VI P

rope

rties

to p

repa

re to

bui

ld a

stan

d-al

one

appl

icat

ion.

•M

odify

the

appl

icat

ion

to c

all t

he Q

uit L

abV

IEW

func

tion

whe

n th

e co

de is

exe

cute

d in

the

run-

time

syst

em.

•M

odify

the

appl

icat

ion

to sp

ecify

a lo

g pa

th re

lativ

e to

the

stan

d-al

one

exec

utab

le.

Impl

emen

tatio

nB

efor

e yo

u bu

ild a

n ap

plic

atio

n, y

ou fi

rst p

repa

re th

e co

de so

that

it e

xecu

tes r

elia

bly

whe

n co

mpi

led

into

an

appl

icat

ion.

Rev

iew

the

Bui

ldin

g A

pplic

atio

ns C

heck

list

1.Se

lect

Hel

p»L

abV

IEW

Hel

p to

ope

n th

e La

bVIE

W H

elp.

2.Se

lect

Fun

dam

enta

ls»B

uild

ing

and

Dis

trib

utin

g A

pplic

atio

ns»B

uild

ing

App

licat

ions

Che

cklis

t.

3.R

evie

w th

e Pr

epar

ing

File

s che

cklis

t ite

ms.

Set

Top

-Lev

el A

pplic

atio

n W

indo

w1.

Ope

n th

e H

isto

gram

Mai

n V

I.

If

you

hav

e ha

rdw

are

conn

ecte

d, o

pen Histogram.lvproj

in th

e <Exercises>\LabVIEW Core 2\Deployment\HW

dire

ctor

y.

Page 130: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 6

Cre

atin

g an

d D

istr

ibut

ing

App

licat

ions

ni.c

om|

6-4

If

you

do

not h

ave

hard

war

e co

nnec

ted,

ope

n Histogram.lvproj

in th

e <Exercises>\LabVIEW Core 2\Deployment\No HW

dire

ctor

y.

In

the

Proj

ect E

xplo

rer w

indo

w, d

oubl

e-cl

ick

His

togr

am M

ain.

vi to

ope

n th

e V

I.

2.Se

lect

File

»VI P

rope

rtie

s to

disp

lay

the

VI P

rope

rties

dia

log

box.

3.Se

lect

Win

dow

App

eara

nce

from

the

Cat

egor

y pu

ll-do

wn

men

u.

4.En

ter a

nam

e, su

ch a

s Histogram Application

, in

the

Win

dow

Titl

e te

xt b

ox.

5.Se

lect

Top

-leve

l app

licat

ion

win

dow

to g

ive

the

fron

t pan

el a

pro

fess

iona

l app

eara

nce

whe

n th

e V

I ope

ns a

s an

exec

utab

le.

6.C

lick

the

Cus

tom

ize

butto

n to

vie

w th

e va

rious

win

dow

setti

ngs t

hat L

abV

IEW

con

figur

es fo

r top

-leve

l app

licat

ion

win

dow

s.

7.C

lick

OK

to c

lose

the

Cus

tom

ize

Win

dow

App

eara

nce

dial

og b

ox a

nd c

lick

OK

to c

lose

the

VI P

rope

rtie

s dia

log

box.

8.Sa

ve th

e V

I.

Cal

l the

Qui

t Lab

VIE

W F

unct

ion

1.O

pen

and

mod

ify th

e bl

ock

diag

ram

to c

all t

he Q

uit L

abV

IEW

func

tion

whe

n th

e ap

plic

atio

n fin

ishe

s. Th

e Q

uit L

abV

IEW

func

tion

quits

Lab

VIE

W a

nd q

uits

th

e ap

plic

atio

n af

ter i

t has

exe

cute

d.

Fig

ure

6-1

. A

ddin

g th

e Q

uit L

abV

IEW

Fun

ctio

n to

the

Blo

ck D

iagr

am

2.In

the

Proj

ect E

xplo

rer w

indo

w, s

elec

t File

»Sav

e A

ll to

save

all

the

VIs

.

1P

rope

rty

Nod

e—S

elec

t Ap

plic

atio

n»K

ind

.

2C

ase

Str

uctu

re—

Wire

the

App

licat

ion:

Kin

d ou

tput

to th

e ca

se s

elec

tor

term

inal

and

then

rig

ht-c

lick

the

Cas

e st

ruct

ure

bord

er a

nd s

elec

t Add

Cas

e fo

r E

very

V

alue

.

3Q

uit L

abV

IEW

Fun

ctio

n—P

lace

this

func

tion

in th

e “R

un T

ime

Sys

tem

” ca

se. Y

ou c

an le

ave

the

othe

r ca

ses

empt

y or

del

ete

them

Page 131: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

5

Spe

cify

a F

ile P

ath

Rel

ativ

e to

the

Exe

cuta

ble

His

togr

am M

ain

VI a

lread

y co

ntai

ns c

ode

to sp

ecify

a re

lativ

e pa

th to

the

exec

utab

le a

pplic

atio

n.

Ope

n th

e C

reat

e D

ata

File

VI i

n th

e In

itial

ize

case

of t

he c

onsu

mer

loop

. The

App

licat

ion

Dire

ctor

y V

I cre

ates

a p

ath

rela

tive t

o th

e st

and-

alon

e ap

plic

atio

n w

hen

you

call

the

VI f

rom

a st

and-

alon

e ap

plic

atio

n. O

ther

wis

e, th

e A

pplic

atio

n D

irect

ory

VI r

etur

ns th

e pa

th to

the

fold

er c

onta

inin

g th

e pr

ojec

t file

.

Test

1.R

un th

e H

isto

gram

Mai

n V

I to

ensu

re th

at it

is w

orki

ng.

2.Sa

ve th

e V

I and

the

proj

ect.

End

of E

xerc

ise

6-1A

Page 132: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 133: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

7

Exe

rcis

e 6-

1BC

reat

ing

and

Deb

uggi

ng a

Sta

nd-A

lone

App

licat

ion

Goa

lC

reat

e a

build

spec

ifica

tion,

bui

ld a

stan

d-al

one

appl

icat

ion

(EX

E) in

Lab

VIE

W, a

nd d

ebug

the

appl

icat

ion

runn

ing

on th

e lo

cal c

ompu

ter.

Sce

nario

Cre

ate

a st

and-

alon

e ap

plic

atio

n to

run

the

His

togr

am M

ain

VI.

Afte

r you

pre

pare

you

r file

s, yo

u cr

eate

an

App

licat

ion

(.exe

) Bui

ld S

peci

ficat

ion,

and

run

the

appl

icat

ion.

You

then

use

Lab

VIE

W to

deb

ug th

e ru

nnin

g ap

plic

atio

n.

Des

ign

Use

the

App

licat

ion

(EX

E) B

uild

Spe

cific

atio

ns to

cre

ate

a st

and-

alon

e ap

plic

atio

n fo

r the

his

togr

am a

pplic

atio

n.

Con

nect

with

the

runn

ing

appl

icat

ion

by c

reat

ing

a de

bugg

ing

sess

ion

in L

abV

IEW

.

Impl

emen

tatio

nC

reat

ing

an A

pplic

atio

n (E

XE

) B

uild

Spe

cific

atio

n1.

Ope

n Histogram.lvproj

in th

e <Exercises>\LabVIEW Core 2\Deployment

dire

ctor

y.

2.R

ight

-clic

k B

uild

Spe

cific

atio

ns in

the

Proj

ect E

xplo

rer

win

dow

and

sele

ct N

ew»A

pplic

atio

n (E

XE

) fro

m th

e sh

ortc

ut m

enu.

3.(O

ptio

nal)

Plac

e a ch

eckm

ark

in th

e Do

not p

rom

pt a

gain

for t

his o

pera

tion

chec

kbox

and

clic

k th

e OK

but

ton

if yo

u re

ceiv

e a p

rom

pt ab

out S

SE2

optim

izat

ion.

4.M

odify

the

filen

ame

of th

e ta

rget

and

des

tinat

ion

dire

ctor

y fo

r the

app

licat

ion

in th

e In

form

atio

n ca

tego

ry.

Se

lect

the

Info

rmat

ion

cate

gory

.

C

hang

e th

e T

arge

t file

nam

e to

HistogramData.exe

.

En

ter <

Exercises>\LabVIEW Core 2\Deployment\Executable

in th

e D

estin

atio

n di

rect

ory

text

box

.

Tip

You

do n

ot n

eed

to c

reat

e th

e di

rect

ory.

Lab

VIE

W c

reat

es a

ny d

irect

orie

s tha

t you

spec

ify.

5.Sp

ecify

the

top-

leve

l VI f

or th

e ap

plic

atio

n.

Se

lect

the

Sour

ce F

iles c

ateg

ory.

Se

lect

the

His

togr

am M

ain.

vi in

the

Proj

ect F

iles t

ree.

Page 134: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 6

Cre

atin

g an

d D

istr

ibut

ing

App

licat

ions

ni.c

om|

6-8

C

lick

the

right

arr

ow n

ext t

o th

e St

artu

p V

Is li

stbo

x to

add

the

sele

cted

VI t

o th

e St

artu

p V

Is li

stbo

x.

6.In

clud

e co

de to

allo

w d

ebug

ging

of t

he e

xecu

tabl

e.

Se

lect

the

Adv

ance

d ca

tego

ry.

Pl

ace

a ch

eckm

ark

in th

e E

nabl

e de

bugg

ing

chec

kbox

.

C

lick

OK

.

7.In

the

Proj

ect E

xplo

rer

win

dow

, sel

ect F

ile»S

ave

All.

8.In

the

Proj

ect E

xplo

rer

win

dow

, rig

ht-c

lick

the

My

App

licat

ion

build

spec

ifica

tion

and

sele

ct B

uild

from

the

shor

tcut

men

u.

9.C

lick

Don

e in

the

Bui

ld st

atus

win

dow

.

Run

ning

the

App

licat

ion

Exe

cuta

ble

1.C

lose

the

His

togr

am P

roje

ct E

xplo

rer w

indo

w a

nd c

lose

Lab

VIE

W.

2.N

avig

ate

to <Exercises>\LabVIEW Core 2\Deployment\Executable

in W

indo

ws E

xplo

rer.

3.R

un HistogramData.exe

.

C

lick

the

Snap

shot

but

ton.

C

lick

the

Stop

but

ton

whe

n do

ne.

4.V

erify

that

the

appl

icat

ion

clos

ed w

hen

you

stop

ped

the

appl

icat

ion

and

the

appl

icat

ion

crea

ted

a te

xt fi

le in

the

Logg

ed D

ata

fold

er w

ithin

the

Exec

utab

le fo

lder

.

Deb

uggi

ng th

e E

xecu

tabl

e on

the

Sam

e C

ompu

ter

1.La

unch

Lab

VIE

W.

2.R

un HistogramData.exe

.

3.Se

lect

Ope

rate

»Deb

ug A

pplic

atio

n or

Sha

red

Lib

rary

from

the

LabV

IEW

men

u.

4.En

ter l

ocalhost

in th

e M

achi

ne n

ame

or IP

add

ress

text

box

.

Page 135: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

9

5.Se

lect

His

togr

amD

ata.

exe

from

the

App

licat

ion

or sh

ared

libr

ary

drop

-dow

n m

enu.

C

lick

the

Ref

resh

but

ton

if H

isto

gram

Dat

a.ex

e do

es n

ot a

ppea

r in

the

list.

6.C

lick

the

Con

nect

but

ton

to c

reat

e th

e de

bugg

ing

conn

ectio

n.

7.St

art d

ebug

ging

the

runn

ing

appl

icat

ion.

O

pen

the

bloc

k di

agra

m.

Tu

rn o

n Ex

ecut

ion

Hig

hlig

htin

g.

Tr

y us

ing

prob

es, b

reak

poin

ts, a

nd si

ngle

-ste

ppin

g.

8.St

op th

e ap

plic

atio

n by

clic

king

the

Stop

but

ton

in th

e de

bugg

ing

win

dow

.

End

of E

xerc

ise

6-1B

Page 136: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 137: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

11

Exe

rcis

e 6-

1CB

uild

ing

an In

stal

ler

and

Deb

uggi

ng o

n a

Rem

ote

Mac

hine

Goa

lC

reat

e an

inst

alle

r bui

ld sp

ecifi

catio

n an

d bu

ild th

e in

stal

ler.

As a

cha

lleng

e, re

mot

ely

debu

g th

e ap

plic

atio

n cr

eate

d by

the

inst

alle

r.

Sce

nario

Cre

atin

g an

inst

alle

r sim

plifi

es d

eplo

ying

an

appl

icat

ion

on m

ultip

le m

achi

nes.

Afte

r you

hav

e pr

epar

ed y

our f

iles,

you

crea

te a

n A

pplic

atio

n (.exe

) Bui

ld

Spec

ifica

tion

and

then

cre

ate

an In

stal

ler B

uild

Spe

cific

atio

n.

Des

ign

Use

an

Inst

alle

r Bui

ld S

peci

ficat

ion

to c

reat

e an

inst

alle

r for

the

App

licat

ion

(.exe

) Bui

ld S

peci

ficat

ion

you

crea

ted

in E

xerc

ise

6-1B

.

Impl

emen

tatio

n

Rev

iew

the

Bui

ldin

g A

pplic

atio

ns C

heck

list

1.O

pen

the

LabV

IEW

Hel

p by

sele

ctin

g H

elp»

Lab

VIE

W H

elp.

2.Se

lect

Fun

dam

enta

ls»B

uild

ing

and

Dis

trib

utin

g A

pplic

atio

ns»B

uild

ing

App

licat

ions

Che

cklis

t.

3.R

evie

w th

e C

onfig

urin

g B

uild

Spe

cific

atio

ns c

heck

list i

tem

s.

Cre

atin

g an

Inst

alle

r B

uild

Spe

cific

atio

n1.

Rig

ht-c

lick

Bui

ld S

peci

ficat

ions

in th

e Pr

ojec

t Exp

lore

r w

indo

w a

nd se

lect

New

»Ins

talle

r fr

om th

e sh

ortc

ut m

enu.

2.M

odify

the

inst

alle

r des

tinat

ion

in th

e Pr

oduc

t Inf

orm

atio

n ca

tego

ry.

Se

lect

the

Prod

uct I

nfor

mat

ion

cate

gory

.

Ty

pe <Exercises>\LabVIEW Core 2\Deployment\Installer

as t

he In

stal

ler d

estin

atio

n.

3.Sp

ecify

the

Exec

utab

le B

uild

Spe

cific

atio

n.

C

lick

the

Sour

ce F

iles c

ateg

ory.

Se

lect

the

My

App

licat

ion

build

spec

ifica

tion.

Page 138: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 6

Cre

atin

g an

d D

istr

ibut

ing

App

licat

ions

ni.c

om|

6-12

Se

lect

Pro

gram

File

s»H

isto

gram

in th

e D

estin

atio

n V

iew

tree

.

C

lick

the

right

arr

ow n

ext t

o th

e Pro

ject

File

s Vie

w tr

ee to

pla

ce th

e hi

stog

ram

exe

cuta

ble

and

all e

xecu

tabl

e su

ppor

t file

s und

er P

rogr

am F

iles»

His

togr

am

in th

e D

estin

atio

n V

iew

tree

, as s

how

n in

Fig

ure

6-2. Fig

ure

6-2

. In

stal

ler

Sou

rce

File

s C

ateg

ory

Page 139: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

13

4.A

dd th

e N

I Lab

VIE

W R

un-T

ime

Engi

ne to

the

inst

alle

r by

mod

ifyin

g th

e A

dditi

onal

Inst

alle

rs c

ateg

ory.

No

teIf

you

incl

ude

addi

tiona

l ins

talle

rs in

you

r bui

ld, m

ake

sure

the

prod

uct i

nsta

ller f

iles a

re a

vaila

ble.

Som

e in

stal

ler f

iles,

such

as t

he L

abV

IEW

R

un-T

ime

Engi

ne, a

re a

lread

y ca

ched

on

your

bui

ld sy

stem

. For

oth

er in

stal

ler f

iles,

such

as D

AQ

mx,

you

mig

ht n

eed

to in

sert

the

CD

or D

VD

that

con

tain

s th

e pr

oduc

t ins

talle

r file

s int

o a

CD

/DV

D d

rive.

If y

ou a

re c

ompl

etin

g th

is e

xerc

ise

in a

cla

ssro

om e

nviro

nmen

t, th

e D

AQ

mx

inst

alle

r is p

roba

bly

not a

vaila

ble.

The

refo

re, d

o no

t sel

ect t

he D

AQ

mx

driv

er.

How

ever

, if y

ou c

ompl

ete

this

exe

rcis

e ba

ck a

t you

r offi

ce, y

ou w

ill w

ant t

o in

clud

e th

e N

I-D

AQ

mx

Cor

e R

untim

e in

stal

ler i

n yo

ur b

uild

.

Se

lect

the

Add

ition

al In

stal

lers

cat

egor

y.

Se

lect

the

NI L

abV

IEW

Run

-Tim

e E

ngin

e 20

12 in

stal

ler.

C

lick

OK

.

5.In

the

Proj

ect E

xplo

rer

win

dow

, rig

ht-c

lick

the

My

Inst

alle

r bu

ild sp

ecifi

catio

n an

d se

lect

Bui

ld fr

om th

e sh

ortc

ut m

enu.

6.C

lick

Don

e w

hen

LabV

IEW

fini

shes

bui

ldin

g th

e in

stal

ler.

Test

1.R

un th

e setup.exe

file

in th

e <Exercises>\LabVIEW Core 2\Deployment\Installer\Volume

dire

ctor

y.

2.Fo

llow

the

inst

ruct

ions

on-

scre

en to

inst

all t

he a

pplic

atio

n. B

y de

faul

t, th

e ex

ecut

able

is c

reat

ed in

side

the <Program Files>\Histogram

dire

ctor

y.

3.R

un th

e ap

plic

atio

n by

sele

ctin

g St

art»

Prog

ram

s»H

isto

gram

»His

togr

amD

ata.

Cha

lleng

eIf

you

hav

e in

tern

et a

cces

s dur

ing

clas

s, try

to d

ebug

the

exec

utab

le o

n a

rem

ote

com

pute

r.

1.V

erify

that

cla

ssro

om h

as in

tern

et a

cces

s.

2.D

ecid

e w

heth

er to

deb

ug a

cla

ssm

ate’

s app

licat

ion

or in

stal

l you

r app

licat

ion

on y

our c

lass

mat

e’s c

ompu

ter.

Page 140: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

Less

on 6

Cre

atin

g an

d D

istr

ibut

ing

App

licat

ions

ni.c

om|

6-14

3.If

you

dec

ide

to d

ebug

you

r ow

n ap

plic

atio

n on

a re

mot

e co

mpu

ter y

ou m

ust d

istin

guis

h yo

ur a

pplic

atio

n fr

om th

e ap

plic

atio

ns a

lread

y on

you

r cla

ssm

ate’

s co

mpu

ter.

In

the

inst

alle

r bui

ld sp

ecifi

catio

n, re

nam

e yo

ur a

pplic

atio

n w

ith a

uni

que

nam

e.

Tr

ansf

er y

our i

nsta

ller t

o th

e re

mot

e co

mpu

ter u

sing

a U

SB fl

ash

driv

e or

the

netw

ork.

In

stal

l you

r app

licat

ion.

4.To

use

Lab

VIE

W o

n yo

ur co

mpu

ter t

o de

bug

a run

ning

appl

icat

ion

on a

rem

ote c

ompu

ter,

you

mus

t det

erm

ine t

he IP

addr

ess o

f the

rem

ote c

ompu

ter,

also

kno

wn

as th

e D

estin

atio

n co

mpu

ter.

No

teC

onsi

der y

our c

ompu

ter t

o be

the

Dev

elop

men

t com

pute

r and

you

r cla

ssm

ate’

s com

pute

r to

be th

e D

estin

atio

n co

mpu

ter.

O

pen

the

Win

dow

s Sta

rt m

enu

on th

e D

estin

atio

n co

mpu

ter.

En

ter c

md

in th

e se

arch

box

and

pre

ss th

e <E

nter

> ke

y.

Ty

pe ipconfig

at t

he p

rom

pt in

the

Com

man

d w

indo

w a

nd p

ress

the

<Ent

er>

key.

N

ote

the

IP a

ddre

ss.

5.R

un th

e ap

plic

atio

n on

the

Des

tinat

ion

com

pute

r.

6.O

n th

e D

evel

opm

ent c

ompu

ter,

laun

ch L

abV

IEW

, if n

eces

sary

.

7.Se

lect

Ope

rate

»Deb

ug A

pplic

atio

n or

Sha

red

Lib

rary

from

the

LabV

IEW

men

u.

8.En

ter t

he IP

add

ress

of t

he D

estin

atio

n co

mpu

ter i

n th

e M

achi

ne n

ame

or IP

add

ress

text

box

.

9.Se

lect

the

exec

utab

le fr

om th

e A

pplic

atio

n or

shar

ed li

brar

y dr

op-d

own

men

u.

C

lick

the

Ref

resh

but

ton

if th

e ex

ecut

able

you

wan

t doe

s not

app

ear i

n th

e lis

t.

10.C

lick

the

Con

nect

but

ton

to c

reat

e th

e de

bugg

ing

conn

ectio

n.

Page 141: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|6-

15

11.S

tart

debu

ggin

g th

e ru

nnin

g ap

plic

atio

n.

O

pen

the

bloc

k di

agra

m.

Tu

rn o

n Ex

ecut

ion

Hig

hlig

htin

g.

Tr

y us

ing

prob

es, b

reak

poin

ts, a

nd si

ngle

-ste

ppin

g.

12.S

top

the

appl

icat

ion

by c

licki

ng th

e St

op b

utto

n in

the

debu

ggin

g w

indo

w.

End

of E

xerc

ise

6-1C

Page 142: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches
Page 143: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|A

-1AS

ettin

g U

p Yo

ur H

ardw

are

This

app

endi

x co

ntai

ns in

stru

ctio

ns o

n se

tting

up

your

har

dwar

e.

No

teC

ompl

ete

this

setu

p on

ly if

you

hav

e ha

rdw

are

inst

alle

d an

d ha

ve n

ot al

read

y co

mpl

eted

har

dwar

e set

up o

n yo

ur sy

stem

as p

art o

f a L

abVI

EW C

ore

1 co

urse

exe

rcis

e.

1.La

unch

MA

X b

y se

lect

ing

Star

t»Pr

ogra

ms»

Nat

iona

l Ins

trum

ents

»Mea

sure

men

t & A

utom

atio

n or

by

doub

le-c

licki

ng th

e MA

X ic

on o

n yo

ur d

eskt

op. M

AX

se

arch

es th

e co

mpu

ter f

or in

stal

led

Nat

iona

l Ins

trum

ents

har

dwar

e an

d di

spla

ys th

e in

form

atio

n.

2.C

reat

e a

cust

om sc

ale

for t

he te

mpe

ratu

re se

nsor

on

the

DA

Q S

igna

l Acc

esso

ry. T

he se

nsor

con

vers

ion

is li

near

and

use

s the

follo

win

g th

e fo

rmul

a Voltagex

100 = Celsius

.

Page 144: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

App

endi

x A

Set

ting

Up

Your

Har

dwar

eni

.com

|A

-2

Fig

ure

A-1

. T

empe

ratu

re S

cale

R

ight

-clic

k th

e Sc

ales

sect

ion

and

sele

ct C

reat

e N

ew fr

om th

e sh

ortc

ut m

enu.

Se

lect

NI-

DA

Qm

x Sc

ale.

C

lick

Nex

t.

Se

lect

Lin

ear.

N

ame

the

scal

e Temperature

.

Page 145: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches

LabV

IEW

Cor

e 2

Exe

rcis

es©

Nat

iona

l Ins

trum

ents

|A

-3

C

lick

Fini

sh.

C

hang

e th

e Sc

alin

g Pa

ram

eter

Slo

pe to

100

.

U

nder

Uni

ts, e

nter

Celsius

in th

e Sc

aled

fiel

d.

C

lick

the

Save

but

ton

on th

e to

olba

r to

save

the

scal

e.

C

lose

MA

X b

y se

lect

ing

File

»Exi

t.

Page 146: Core 2 LabVIEW - web.cas.suffolk.eduweb.cas.suffolk.edu/faculty/lshatz/ece310s2_2016/Labview for... · Student Guide ni.com | vi B. Course Description The LabVIEW Core 2 course teaches