Professional Documents
Culture Documents
401 Mechatronics
Laboratory
Two
Waveform
Generation
and
Sub-VIs.
Required Materials
Hardware
Software
Lab P.C.
Labview
Study
Material
Course
Text
LabVIEW
Manual
Purpose
To
generate
and
combine
a
sinusoidal
analog
signal
with
white
and
random
noise.
The
topic
of
sub-VIs
will
be
addressed.
Introduction
LabVIEW
includes
a
large
variety
of
VIs
that
allow
for
the
generation
and
analysis
of
many
different
waveforms.
Today
you
will
gain
experience
in
LabVIEW
with
sine
waveforms,
observing
their
behavior,
and
corrupting
them
with
white
and
random
additive
noise.
In
real
system
Part
1:
Create
VI
Purpose:
Generate
a
sine
wave
and
output
this
waveform
to
a
waveform
graph.
Procedure:
1. Create
a
new
VI
2. Add
a
Sine
Wave
Generator
a.
b.
c.
d.
Now
go
to
front
panel
and
bring
up
the
control
menu
by
right
clicking.
Go
to
modern
sub-palette
and
select
the
waveform
graph
from
graphs
sub-palette.
Place
the
waveform
graph
by
left
click
on
the
front
panel.
e.
f.
Now
we
need
to
create
a
sub
.vi
Part
2:
Create
a
SubVI
Purpose:
Create
a
sub-vi
that
will
add
two
types
of
noise
to
the
sine
waveform
in
Part
1.
Procedure:
5. Now
move
to
Block
diagram
and
Wire
the
Radio
button
to
the
Case
Structure
case
selector
located
on
the
case
structure
frame.
Notice
the
changes
in
the
frame
names
of
case
structure.
6. Select
the
Signal-processing
subpalette
of
the
Function
menu,
select
waveform
generation
and
select
the
Uniform
white
noise
waveform.vi
and
place
it
inside
the
Uniform
white,
Default
frame
of
the
case
structure.
7. Now
right
click
on
the
amplitude
terminal
of
Uniform
white
noise
waveform.vi
and
go
to
create
and
select
control.
Notice
the
changes
in
front
panel.
Follow
the
same
procedure
for
sampling
info
terminal.
Note:
Amplitude
and
Sampling
Info
should
be
outside
of
the
case
structure
in
order
that
the
same
controls
be
used
for
both
cases.
8. Go
to
front
panel
and
bring
up
the
control
menu
by
right
click.
Go
to
modern
subpalette
and
select
the
waveform
chart
from
graphs
subpalette.
Place
the
waveform
chart
by
left
click
on
the
front
panel.
9. Return
to
the
block
diagram
and
move
the
waveform
chart
block
outside
of
the
case
structure.
Wire
the
waveform
chart
in
the
block
diagram
with
the
signal
out
terminal
of
the
Uniform
white
noise
waveform.vi
10. Following
the
same
procedure,
add
Periodic
Random
Noise
Waveform.vi
in
frame
periodic
random
of
case
structure.
Wire
the
amplitude
tunnel
on
the
edge
of
the
case
structure
to
the
spectral
amplitude
terminal.
Similarly,
wire
the
sampling
info
and
waveform
chart
tunnels
to
the
periodic
random
noise
block
terminals.
Your
Front
Panel
and
Block
Diagram
should
look
like
this
for
the
sub-vi
ConTiguring
the
Sub
.vi
to
accept
inputs
and
outputs
1. Return
to
the
front
panel
and
locate
the
connector
panel
icon
in
the
upper
right
hand
corner.
The
pane
should
be
broken
into
empty
blocks.
2. Click
on
a
connector
pane
block
and
then
the
Boolean
control
(radio
buttons).
Click
on
a
second
block
and
then
your
amplitude
control.
Click
on
a
third
block
and
then
your
sampling
information
cluster.
Click
on
the
last
block
and
then
on
the
waveform
chart.
Your
sub-vi
is
now
conUigured
to
accept
inputs
and
return
outputs.
Save
this
sub-vi
if
you
havent
already.
(Dont
get
confused,
note
that
we
are
dealing
with
sub-
vi)
When
you
place
the
sub-vi
into
your
main
program
block
diagram,
the
sub-vi
block
will
have
terminals
corresponding
to
the
radio
buttons,
amplitude,
sampling
info
and
waveform
chart.
Part
3:
Connecting
your
Main
VI
to
your
SubVI
1. Open
your
VI
form
Part
1
and
in
the
functions
palette
in
the
block
diagram
Uind
the
select
a
vi
subpalette.
Choose
the
name
of
your
sub-vi
and
place
it
in
the
block
diagram.
2. Now
right
click
on
the
amplitude
terminal
of
your
sub-vi
and
go
to
create
and
select
control.
Notice
the
changes
in
front
panel.
Follow
the
same
procedure
for
the
radio
buttons
terminal.
Connect
sampling
info
to
the
previously
created
sampling
info
controlling
the
sine
wave
generator.
3. Rename
the
new
amplitude
control
into
noise
amplitude,
it
will
control
the
noise
waveform.
4. Go
to
front
panel
and
bring
up
the
control
menu
by
right
click.
Go
to
modern
subpalette
and
select
the
waveform
graph
from
graphs
subpalette.
Place
the
waveform
graph
by
left
clicking
on
the
front
panel.
Rename
to
noise
waveform
graph.
5. Wire
the
waveform
chart
terminal
of
sub.vi
waveform
to
the
in
terminal
of
the
noise
waveform
graph.
Part
4:
Outputting
sound
1. Bring
up
the
function
menu
in
the
block
diagram
by
right
clicking.
Go
to
programming
subpalette
and
select
the
Graphics
and
sound
subpalette,
select
the
Sound
subpalette
then
the
Output
subpalette
and
select
the
Sound
output
write.vi
and
place
it
in
right
side
of
the
block
diagram..
Wire
the
x
terminal
of
Add
to
signal
out
of
the
sine
waveform
(also
wired
to
the
waveform
graph).
ii.
Wire
the
y
terminal
of
Add
to
the
output
of
the
sub
vi
(also
wired
to
noise
waveform
graph).
iii. Wire
the
x+y
terminal
(the
output
on
the
right
hand
side)
of
Add
to
the
data
terminal
of
Sound
output
write.vi
and
to
the
Noise
Plus
waveform
graph.
7. Double
check
your
wiring.
Your
circuit
should
look
something
like
this.
8. You
should
now
be
ready
to
run
your
program.
Set
the
sampling
info
for
the
sine
wave
and
the
noise
to
the
following:
Fs:
22050
and
#s:
10000.
Check
the
PC
sound
settings
to
ensure
that
its
not
set
to
mute
and
adjust
the
volume
to
maximum.
Set
the
sine
wave
amplitude
to
0.5
V
and
the
frequency
to
1
kHz
(1000
Hz).
Start
with
the
noise
amplitude
set
to
0.
Execute
the
vi
and
conUirm
you
are
hearing
something
and
your
graphs
are
all
getting
data.
Hit
stop
and
then
run
to
get
another
run
of
the
program.
Each
run
should
output
a
sound
for
less
than
a
second.
Note:
Scaling
graphs
and
charts
You
will
likely
see
something
far
more
distorted
when
you
Uirst
run
your
vi.
You
need
to
set
the
scale
appropriately
so
you
can
see
what
is
happening.
Default
setting
is
for
the
X
and
Y
scales
to
be
set
for
autoscaling,
this
can
be
very
helpful
or
it
can
be
a
pain.
Right
click
on
the
graph
and
uncheck
autoscale
X
under
the
x
scale
drop
down
menu.
Now
you
can
set
the
scale
and
have
it
stay
how
you
want
it.
There
are
a
number
of
ways
to
set
the
scale
in
these
graphs.
You
can
right
click,
then
select
properties,
the
adjust
the
max
and
min
on
the
scales
tab.
You
can
left
click
directly
on
the
numbers
on
the
axis
and
change
them.
One
of
the
easier
methods
is
to
use
the
zoom
tool.
Right
click
on
the
graph
and
select
visible
items,
then
check
Graph
Palette.
This
palette
should
appear
somewhere
below
or
beside
your
graph:
When
you
click
the
middle
button
a
sub-palette
shows
up,
select
the
middle
of
the
top
row:
Once
selected
your
cursor
should
switch
to
a
magnifying
glass.
Draw
a
square
around
a
region
of
the
graph
to
zoom
into
that
region.
Continue
to
zoom
until
you
have
a
good
image
on
your
graph.
If
you
zoom
too
far,
the
bottom
left
selection
will
return
the
graph
to
full
size.
9. With
the
noise
amplitude
set
to
0
the
waveform
graph
and
the
noise
plus
waveform
graph
should
be
identical.
Now
try
setting
the
noise
amplitude
to
0.2
V
as
shown
in
the
screenshot.
Plot
your
front
panel
and
block
diagram.
Make
sure
you
can
see
three
distinct
waveforms,
with
the
third
being
an
obvious
combination
of
the
Tirst
two.
If
you
are
not
sure
about
the
quality
of
your
waveforms
have
the
TA
conTirm
they
are
okay.
Set
the
noise
amplitude
to
0.
Keeping
the
frequency
at
1
kHz
change
the
amplitude
to
0.1
V,
0.01
V,
and
1
V,
describe
how
the
output
(the
sound
coming
from
the
speaker)
is
affected
by
changing
amplitude.
Set
the
amplitude
back
to
0.5
V
and
try
different
frequencies.
For
each
of
the
following
frequencies
describe
the
output,
200
Hz,
500
Hz,
1
kHz,
3
kHz,
10
kHz.
Now
set
the
wave
back
to
0.5
V
amplitude
and
1
kHz
frequency
and
try
introducing
noise.
Try
0.05
V
amplitude
(1/10
of
your
primary
amplitude),
0.5V
(equal
amplitude),
and
5
V
(10
times
the
amplitude
of
the
primary).
Report
on
the
effects
with
both
uniform
and
random
noise.
Lab
reports
format
should
be
the
same
as
indicated
in
Lab
1
before.
Please
refer
to
the
Lab
1
instructions
if
you
have
any
questions
about
grading
or
BONUS
(1
points):
Using
the
speaker
found
in
lab
(there
are
only
a
couple,
so
only
use
them
when
you
think
you
are
ready),
play
the
Tirst
two
bars
of
Mary
Had
a
Little
Lamb.
BONUS
(1
point):
Using
the
speaker
found
in
lab
(there
are
only
a
couple,
so
only
use
them
when
you
think
you
are
ready),
play
at
least
three
chords.
Add
the
ability
to
have
a
pure
chord
or
have
a
chord
corrupted
by
noise.