LabVIEW Programming - Overview PDF
LabVIEW Programming - Overview PDF
page=labview
LabVIEW Programming
Prerequisites
It
is
assumed
you
are
familiar
with
the
LabVIEW
IDE
such
as
Front
Panels,
Block
Diagrams,
Controls
and
FuncOons
Pale4e
You
should
be
familiar
with
SubVIs
You
should
be
familiar
with
dierent
Loops
like
While
Loops,
For
Loops,
Case
Structures,
etc.
Now
it
is
Ome
to
take
the
next
step
and
learn
some
real
LabVIEW
Programming
PDF
File
available
for
download
LabVIEW
Course
IntroducOon
to
LabVIEW
h4p://home.hit.no/~hansha/?training=labview
h4p://ni.com/students/learnlabview
LabVIEW
Course:
h4p://home.hit.no/~hansha/?training=labview
Learning
by
Doing!
It
is
recommended
that
you
watch
some
of
the
videos
before
you
read
furter
LabVIEW
InstallaOon
Download
the
so\ware
here:
h4p://home.hit.no/~hansha/?page=labview
These
are
the
main
modules
we
use
in
the
dierent
courses
at
Telemark
University
College:
LabVIEW
(LabVIEW
Professional
Development
System
32-Bit:
English)
LabVIEW
Control
Design
and
Simula8on
Module
LabVIEW
MathScript
RT
Module
NI-DAQmx
(Hardware
Driver
for
NI
USB-6008,
NI
TC-01,
etc.)
Note!
These
packages
are
separate
downloads!
Make
sure
to
download
and
install
all
of
them!
All
LabVIEW
So\ware
can
be
downloaded
here:
www.ni.com/download
LabVIEW = Fun!
Graphical
Programming:
Very
dierent
from
tradiOonal
programming
like
VB,
C#,
Maple,
MATLAB,
MathScript,
etc.
It
is
more
like
a
drawing
program
than
a
Programming
Language
This
makes
it
easy
to
use
for
those
who
are
not
programmers
(or
dont
like
programming
J)
Excellent
tool
when
using
Hardware,
when
you
need
to
take
Measurements
(DAQ),
etc.
It
is
fun
and
makes
you
very
creaOve!
LabVIEW Example
LabVIEW
has
the
same
things
as
other
programming
languages,
but
in
a
graphical
way!
Sequence
Structure
Comment
While
Loop
Local
Variable
Sub
VI
Property Nodes
Constants
Stop Bu4on
Case
Structure
(if-else)
CondiOon
Arrays
Note!
To
do
something
with
an
object
Right-click
on
it
(When
shall
the
loop
end?)
Hardware
Air Heater
USB-6008
Wi-Fi
DAQ
Water
Tank
Pt-100
TC-01
Arduino
ZigBee
Vision System
cRIO
NOx
Sensor
LabVIEW
This
is
the
core
LabVIEW
installaOon
that
installs
the
LabVIEW
Programming
Environment.
NI-DAQmx
DAQmx
is
the
Hardware
Driver
needed
in
order
to
use
hardware
devices
like
NI
USB-6008,
NI
TC-01,
etc.
inside
LabVIEW.
The
module
is
available
as
a
pale4e
on
your
block
diagram.
Structure your code! Use SubVIs, Avoid Spaghen Code, Document your Code, etc.
This is a comment
Use
SubVIs!!!
Use
Labels
and
Comment
your
Code
While Loop
For Loop
Sequence Structure
O\en,
new
LabVIEW
users
create
re
and
forget
applicaOons
to
accomplish
simple
tasks
and
dont
think
about
how
they
can
use
that
code
in
the
future.
As
users
start
to
program
more
o\en,
they
can
nd
themselves
rewriOng
the
same
piece
of
code
over
and
over
again.
You
can
save
yourself
a
lot
of
development
Ome
by
creaOng
modular
subVIs
out
of
porOons
of
your
code
that
can
be
reused
within
other
applicaOons.
h4p://www.ni.com/pdf/manuals/376039a.pdf
LabVIEW Programming
Contents
Local/Global
Variables
Arrays
Clusters
Property
Nodes/Invoke
Nodes
Debugging
&
Error
Handling
Shi\
Registers
Event
Structure
State
Machine
principle
Project
Explorer
GUI,
VI
ProperOes
Create
Executable
Files
&
InstallaOon
Packages
Local
Variables
You
can
create
Local
Variables
in
3
dierent
ways;
from
the
Structures
pale4e
on
the
Block
Diagram,
right-clicking
the
GUI
object
on
the
Front
Panel,
or
right-clicking
the
items
on
the
Block
Diagram.
Local
Variables
This
Local
Variable
is
connected
to
the
Temperature
Item
WriOng
a
Value
to
the
Local
Variable
Local Variable
Students: ...
Global Variables
Arrays
Arrays
are
very
powerful
to
use
in
LabVIEW.
In
all
your
applicaOons
you
would
probably
use
both
One-Dimensional
Arrays
and
Two-Dimensional
Arrays.
Auto-Indexing
Arrays
Array
FuncOons
You
cannot
work
with
Arrays
without
using
one
or
more
of
the
built-in
Array
FuncOons
Array
FuncOons
Array
Size
Index
Array
Delete
from
Array
Search
1D
Array
IniOalize
Array
Build
Array
Array
Subset
Array
Constant
All
these
funcOons
are
basic
(but
very
useful)
array
funcOons
you
will
probably
be
using
in
all
your
applicaOons
and
VIs.
Clusters
Clusters
Students: ...
Debugging
Tools
Step
into/over/out
debugging
Probes
Breakpoints
Highlight ExecuOon
Probes
Probe
Tool
Probe
Breakpoints
Step into
Step over
Step out
Wiring the Error Cluster between the dierent VIs for Proper Error Handling
Property Nodes
Property Nodes
Students: ...
Invoke Node
Invoke Node
Students: ...
References
References
Project Explorer
Shi\ Registers
Shi\ Registers
Students: ...
Event Structure
Event Structure
Students: ...
State Machine
State Machine
State Machine
State
Machine
Lets
build
our
own
State
Machine
from
scratch
A
State
Machine
consists
of
the
following
main
components:
While
Loop
Shi\
Registers
Case
Structure
Event
Structure
State Machine
Students: ...
GUI/HMI Guidelines
VI ProperOes
Pop-up window
CreaOng Executables
CreaOng Executables
Students: ...
LabVIEW
Course
LabVIEW
Programming
PDF
File
available
for
download
h4p://home.hit.no/~hansha/?training=labview
Students:
Read
the
Course
Manual
and
do
the
Exercises
(as
many
as
possible)
in
the
Course
Manual
on
your
own.
Note!
SoluOons
with
code
for
all
the
exercises
are
located
on
the
web
page
LabVIEW
Training
Here
you
will
nd
lots
of
Videos,
Tutorials
and
Exercises
h4p://ni.com/students/learnlabview
LabVIEW
Course:
h4p://home.hit.no/~hansha/?training=labview
Learning by Doing!
E-mail:
hans.p.halvorsen@hit.no
Blog:
hPp://home.hit.no/~hansha/
58