You are on page 1of 10

Signals, Spectra and Signal Processing

Name:________Edith A. Castillo______________ Rating:__________________________


Date Performed: ___July 10, 2017___________ Date Submitted: ___ July 10, 2017____

Signals, Spectra and Signal Processing

GETTING FAMILIAR WITH LABVIEW (PART II)


Activity No. 2

I. INTENDED LEARNING OUTCOMES

1. Use the debugging tools of LabVIEW.


2. Build a VI that demonstrates the generation of sine wave and its amplitude-scaled version
using Express VIs and regular VIs and compare the advantages and disadvantages of each.
3. Use the graphing tool of LabVIEW to display graphs and charts.

II. BACKGROUND INFORMATION

In the first activity, the basic environment of LabVIEW has been explored. In this activity,
other features of LabVIEW such as the debugging tools and Express VIs are used.

If a VI does not run, it is either broken or non-executable. In the first activity, recall that there is an
error in the program when the Run arrow is broken. Warnings do not prevent you from running a VI
as they are designed to help you avoid potential problems in VIs. Errors, however, can break a VI.
You must resolve any errors before you can run the VI. Some common causes of broken VIs are:
 the block diagram contains a broken wire because of a mismatch of data types or
 a loose unconnected end;
 a required block diagram terminal is unwired; or

 a subVI is broken or you edited its connector pane after you placed its icon on the
block diagram of VI.
In some cases, a VI is not broken but you get an unexpected data. You can use various techniques
to identify and correct problems with VI or the block diagram data flow. You can wire the error-in and
error-out parameters at the bottom of most built-in VIs and functions. These parameters detect
errors encountered in each node on the block diagram and indicate if and where an error occurred.

Express VIs denote higher-level VIs that have been configured to incorporate lower-level VIs or functions.
These VIs are displayed as expandable nodes with a blue background. Placing an Express VI in a BD brings
up a configuration dialog window allowing adjustments of its parameters. As a result, Express VIs demand less
wiring. A configuration window can be brought up by double-clicking on its Express VI.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 1


Signals, Spectra and Signal Processing

III. LEARNING ACTIVITIES

Activity 2.1 – Debugging Tools


1. Obtain the folder act02-01_error. This folder contains the VIs for this part of the
activity. Inside this folder, open act02-01_main.vi by double-clicking on the file. The FP
appears. Notice that this VI is non-executable because the Run button is broken.

2. Press Ctrl+E to make the BD of the VI appear. Notice that there is a subVI called
act02-01_sub.vi. Double-click the subVI and the FP of this subVI appears.

Question: What are the terminal icons and nodes that can be seen in act02-01_main.vi?
Discuss the function of each.
If a VI does not run, it is a broken, or nonexecutable, VI. The Run button appears broken when
the VI you are creating or editing contains errors.

Generally, this means that a required input is not wired, or a wire is broken. Press the broken Run
button to access the Error List window. The Error List window lists each error and describes the
problem. You can double-click an error to go directly to the error.

Warnings do not prevent you from running a VI. They are designed to help you avoid potential
problems in VIs. Errors, however, can break a VI. You must resolve any errors before you can run
the VI.

Click the broken Run button or select View»Error List to find out why a VI is broken. The Error
List window lists all the errors. The Items with Errors section lists the files that have errors. If two
or more items have the same name, this section shows the specific application instance for each
item. The Errors and Warnings section lists the errors and warnings for the VI you select in the
Items with Errors section. The Details section describes the errors and, in some cases,
recommends how to correct the errors. Click the Help button to display a topic in the LabVIEW
Help that describes the error in detail and includes step-by-step instructions for correcting the
error.

Click the Show Error button or double-click the error description to highlight the area on the
block diagram or front panel that contains the error.

Question: Based on the BD’s of the VIs, describe the functionality of this program.
The virtual instrument functions are to show all the possible errors that the designer may
encounter.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 2


Signals, Spectra and Signal Processing

3. Press the broken Run button in the act02-01_main.vi FP or BD. The Error List window appears.

Question: List all the errors as seen on the Error List window. Discuss the details of each.
The block diagram contains a broken wire because of a mismatch of data types or a loose,
unconnected end. Refer to the Correcting Broken Wires topic of the LabVIEW Help for
information about correcting broken wires.
A required block diagram terminal is unwired. Refer to the Using Wires to Link Block Diagram
Objects topic of the LabVIEW Help for information about setting required inputs and outputs.
A subVI is broken or you edited its connector pane after you placed its icon on the block diagram
of the VI.

4. Perform the necessary steps to correct the errors and make the VI executable.

Question: What should be done to correct the errors? Detail your step-by-step solution
in correcting the errors of the VI.
Make sure that all wires are connected to all the desired operation. Make sure the output and
input has same data type.

5. When the VI is executable, click the Highlight Execution button in the toolbar of BD ( ) to start
animating the flow of data in the VI. The Start Single Stepping button ( ) causes the execution of the VI
step-by-step. Continue pressing this icon until the data enters the subVI, in which the same button in that
subVI’s window can be pressed. The execution is finished when a blinking border covers the entire BD, in
which the Finish the “…” button () must be pressed to end the execution of VI.

Note: When the data enters a node, it is automatically reflected in the FP. To make the VI
run in its normal speed, click on Do not Highlight Execution button after using this tool.

Question: How can the Highlight Execution feature help in debugging VIs?
Click the Highlight Execution button to display an animation of the block diagram execution when
you run the VI. Notice the flow of data through the block diagram. Click the button again to
disable execution highlighting.

Execution highlighting shows the movement of data on the block diagram from one node to
another using bubbles that move along the wires. Use execution highlighting with single-stepping to
see how data values move from node to node through a VI.

Note: Execution highlighting greatly reduces the speed at which the VI runs.

Click the Retain Wire Values button to save the wire values at each point in the flow of execution
so that when you place a probe on the wire you can immediately retain the most recent value of
Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 3
the data that passed through the wire. You must successfully run the VI at least once before you
can retain the wire values.
Click the Step Into button to open a node and pause. When you click the Step Into button again,
it executes the first action and pauses at the next action of the subVI or structure. You also can
press the <Ctrl> and down arrow keys. Single-stepping through a VI steps through the VI node by
node. Each node blinks to denote when it is ready to execute.
Click the Step Over button to execute a node and pause at the next node. You also can press the
<Ctrl> and right arrow keys. By stepping over the node, you execute the node without single-
stepping through the node.
Click the Step Out button to finish executing the current node and pause. When the VI finishes
executing, the Step Out button is dimmed. You also can press the <Ctrl> and up arrow keys. By
stepping out of a node, you complete single-stepping through the node and navigate to the next
node.
The Warning button appears if a VI includes a warning and you placed a checkmark in the Show
Warnings checkbox in the Error List window. A warning indicates a potential problem with the
block diagram, but it does not stop the VI from running.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 4


Signals, Spectra and Signal Processing

6. Click on View > Tools Palette and the Tools Palette window appears. Here, various tools in debugging
and interpreting the BD can be seen. Click on the Probe Data icon ( ) to place probes on wires. The
Probe Watch Window appears. When the VI is run, data that passes through this probe is displayed in this

window. You can add text in the BD by using the Edit text tool ( ) to add comments and describe the
functionalities of certain parts of the BD. The Breakpoint tool ( ) can be placed on wires to pause the
execution of VI when it encounters the breakpoint. Click the Continue button to resume the operation of VI.
Click the Breakpoint icon again to remove the placed breakpoints and to stop placing breakpoints.

Question: What is the difference between the Probe Data and the Breakpoint tools of LabVIEW?
Use the Probe tool to check intermediate values on a wire as a VI runs.

Use the Probe tool if you have a complicated block diagram with a series of operations, any one
of which might return incorrect data. Use the Probe tool with execution highlighting, single-
stepping, and breakpoints to determine if and where data is incorrect. If data is available, the
probe immediately updates and displays the data in the Probe Watch Window during execution
highlighting, single-stepping, or when you pause at a breakpoint. When execution pauses at a
node because of single-stepping or a breakpoint, you also can probe the wire that just executed to
see the value that flowed through that wire.

Activity 2.2 – Building a System VI with Express VIs


1. Create the VI act02-02.vi. Build the following BD and FP.

 In the BD, insert Simulate Signal Express VI (Functions Palette > Express > Signal
Analysis > Simulate Signal). The Configure Simulate Signal window appears.

 In this window, set the Frequency (Hz) to 200, Amplitude to 100, Samples per second (Hz) to 8000,
uncheck the Automatic checkbox under the Number of Samples category and set it to 128. This
generates a signal whose amplitude is between 100 to -100, frequency of 200 Hz. The timing

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 5


Signals, Spectra and Signal Processing

information enables one to see clearly the signal by setting the sampling rate
(Samples per second) and the number of samples correctly. Click OK.
 Place a Scaling and Mapping Express VI (Functions Palette > Express > Arithmetic &
Comparison > Scale and Map). The Configure Scaling and Mapping window appears.

 In this configuration window, choose Linear and set the Slope (m) to 5. This will
scale the amplitude (or amplify) the input 5 times. Click OK.

 Wire the Sine output of the Simulate Signal Express VI to the Signal input of the Scaling
and Mapping Express VI. Note: The wire used for connecting the Express VI together is
for a dynamic data type, that is, it carries dynamic data or data that change over time.

 Switch to FP. Insert a Waveform Graph (Controls Palette > Express > Graph
Indicator > Waveform Graph). Right-click on the Waveform Graph, choose X
Scale and uncheck the Loose Fit option and Ignore Time Stamp.

 Right-click on the Waveform Graph then choose Properties. On the Display Format
tab, under the Default Editing Mode, set the Time (X-Axis) axis data Type to Floating
point. Then choose Digits of Precision as the Precision Type. Set the Digits to 2.

 Switch back to BD. The terminal icon for the Waveform Graph should have appeared.
Connect the outputs of the Scaling and Mapping and Simulate Signal Express VIs to the
 Waveform Graph. On the process, the Merge Signals node appears automatically.
 Enclose the diagram with a While-Loop structure to make the program run continuously.

2. Save and run the VI.

Question: Describe the functionality of the VI.


The virtual instrument that was made is about generating a waveform from a signal. This is done
by simulating a signal through the “Simulate Signal” then the output will go to the “Scaling and
Mapping” that functions through scaling the simulated signal. After that, the scaled signals will go
to the waveform graph which displays the waveform of the signal. This is continuously working
since it is in the while loop.

Question: If the Loose Fit option of the X-Scale of the Waveform Graph is enabled, what
happens to the plot?
The plot does that fit to the space provided for displaying the output waveform.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 6


Signals, Spectra and Signal Processing

Question: The reading in the Waveform Graph runs too fast. What can be done about this?
This is due to the properties of “Simulate Signal”. The “Simulate Signal” had set its timing
samples per second in 8000Hz so that the waveform graph runs too fast.

Question: How does the Sampling Frequency and the Number of Samples parameters
of the Express VI affect the VI? Adjust the values and observe.
The sampling frequency used to set the generated waveform of signal in cycle per second while the
number of samples used to take the desired samples in the generated waveform of the signal so
that those samples will set to make the waveform.

Activity 2.3 – Building a System with Regular VIs


1. Create a blank VI named act02-03.vi. Build the BD and FP as shown.

Note: To aid in configuring this VI, open the Context Help for this VI. Click Help and select Show Context
Help (or press Ctrl+H). The Context Help window appears. The terminals for selected VIs will be shown

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 7


Signals, Spectra and Signal Processing

here. Click on the Basic Function Generator VI to show context help for that VI. A more
detailed help is provided when the Detailed Help link at the bottom is clicked.

 Insert a Basic Function Generator VI (Functions Palette > Programming > Waveform
> Analog Waveform > Waveform Generation > Basic FuncGen). The parameters of
this function generator will be configured using constants and controls.

 Right-click on the Signal Type terminal and choose Create > Constant. An Enum (enumerated)
type constant appears, the default being Sine Wave. Note: An Enum data type is one in which a
string value is associated with a numeric value, from zero to n – 1, n being the number of choices.
The Enum constant for the Signal Type input includes Sine Wave (value is 0, the default value),
Triangle Wave (value is 1), Square Wave (value is 2) and Sawtooth Wave (value is 3).

 Right-click on the Frequency terminal and create a constant whose value is 200 (the default unit
of this terminal is hertz). Right-click on the Amplitude terminal and create a constant whose value
is 100. Right-click on the Sampling Info terminal and create a constant in this terminal. There are
two constants to be defined. Put 8000 in the Sampling Rate (Fs) and 128 in the Number of
Samples (#s). Note: These are the values we have set in the previous activity.

 Insert a Multiply function. Wire the Signal Out of the Basic Function Generator VI to one of
the inputs of the Multiply function, while on the other one, create a constant with a value of 5.

 Insert a Build Array (Functions Palette > Programming > Array > Build Array)
node. Drag down another element of the node so that two arrays can be
appended. Wire the output of the Basic Function Generator VI on the first input
terminal and the output of the Multiply node on the second input terminal.

 Switch to FP. Insert a Waveform Graph. Right-click on the graph and disable the
Loose Fit option in the X Scale and the Autoscale Y in the Y Scale options of the
graph. Change the limits of the y-axis of the graph by clicking on the maximum
and minimum values and changing it to 600 and -600 respectively.

 Right-click on the Waveform Graph then choose Properties. On the Display Format
tab, under the Default Editing Mode, set the Time (X-Axis) axis data Type to Floating
point. Then choose Digits of Precision as the Precision Type. Set the Digits to 2.

 Switch back to BD. Enclose the entire VI inside a While-Loop structure. Insert a
Wait (ms) (Functions Palette > Programming > Timing > Wait (ms)). Right-click
on the milliseconds to wait terminal of the Wait (ms) node and enter 200. This will
delay the execution of the While-Loop by 200 ms per iteration.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 8


Signals, Spectra and Signal Processing

2. Save and run the VI.

Question: Describe the functionality of the VI. Compare it with the VI in the previous activity.
This virtual instrument used to graph the signal in the waveform graph. The “Basic Function
Generator” provides the signal having a sine wave for this activity. The “Build Array” used to
make coordinates that will used for the graphing of waveform in the waveform graph. This is also
function continuously since it is inside a while loop.

Question: Which one (act02-02.vi or act02-03.vi) is easier to build? Why?


For me, the easier to build is the act02-02.vi because the components are less compared to the
act02-03.vi

Question: What does the Build Array function do?


The “Build Array” is used to construct array using the two inputs which are the elements and the
output will be the appended array.

IV. CONCLUSIONS
The student used the debugging tools of LabVIEW. The student also built a VI that
demonstrates the generation of sine wave and its amplitude-scaled version using Express VIs and
regular VIs and compare the advantages and disadvantages of each. The amplitude-scaled version
using Express VIs is the virtual instrument that was made is about generating a waveform from a
signal. This is done by simulating a signal through the “Simulate Signal” then the output will go to
the “Scaling and Mapping” that functions through scaling the simulated signal. After that, the
scaled signals will go to the waveform graph which displays the waveform of the signal. This is
continuously working since it is in the while loop. The amplitude-scaled version using regular VIs
is virtual instrument used to graph the signal in the waveform graph. The “Basic Function
Generator” provides the signal having a sine wave for this activity. The “Build Array” used to make
coordinates that will used for the graphing of waveform in the waveform graph. This is also
function continuously since it is inside a while loop. Comparing the two-same function virtual
instruments, better to build the first one since the components are few.
After this activity, I was able to meet all the intended outcomes and it is a success.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 9


Signals, Spectra and Signal Processing

V. MACHINE PROBLEM

1. Modify act02-02.vi to make it interactive, that is, the frequency of the input signal, and
the gain of the amplifier can be changed by the user. Refer to the FP below as an
example. Design a more appealing and functional FP. Name the VI as macpro02-01.vi.

2. Modify act02-03.vi to make it interactive. The frequency, gain and the signal type of
the input signal must be user-defined. Refer to the FP below as an example. Design a
more appealing and functional FP. Name the VI for this case study as macpro02-02.vi.

VI. REFERENCE
Kehtarnavaz, N. & Kim, N. (2005). Digital Signal Processing System-Level Design
Using LabVIEW. Oxford, United Kingdom: Elsevier, Inc.

Activity No. 2 – Getting Familiar with LabVIEW (Part II) Page 10

You might also like