Digital Signal Processing with
LabVIEW 8.6
Lab # 04
Arrays, Clusters, Enums, Executables, VI
Protection, Variables
Designed by
Adnan Niazi
Lab Engineer
Signal Processing/Signal & Systems Lab
CECOS University of IT & Emerging Sciences
20th- 21th Feb 2009
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Agenda
▌ What are Arrays
▌ What are Clusters
▌ What is an Enum
▌ What is an Executable
▌ How to password protect a VI
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Why use Arrays
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Arrays
▌ Array is a collection of data of the same
data type
▌ Array can be of controls or indicators but
not both at the same time
▌ Array may contain Boolean, string,
numeric controls or indicators
▌ Array Index always starts from zero and
goes to N-1 in an N element array
▌ Array can be multi-dimensional
008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to place an Array
▌ First place an Empty Array Shell
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to place an Array
▌ Place the control or indicator you want to make an array
of
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to make arrays
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Array Example
▌ Design a VI that continuously generates 10 random
numbers after each 200ms. Display the random numbers
generated in an array, graph and chart
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Array Example
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Clusters
▌ Cluster is used to store data of
different data types
▌ Similar to Struct in C Language
▌ Cluster element can contain Boolean,
string and numeric data types at the
same time
▌ Clusters have thick pink wires
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to make a cluster
▌ First place an Empty Cluster shell
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to make a cluster
▌ Drag the controls or indictors inside the cluster shell
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to make a Cluster
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Bundle
▌ Bundle function helps in creating a cluster from block
diagram objects (Constants and Controls)
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Bundle by Name
▌ Bundle by Name is used to modify existing clusters
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Bundle
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Unbundle
▌ Unbundle is used to tap out all the contents of a cluster
when they are needed
Bundle
Unbundle
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Unbundle by name
▌ Unbundle by name Unbundles only those elements of
the cluster that you need
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Unbundle
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Advantages of Clusters
▌ Clusters help reduce number of wires on the block
diagram
▌ Clean Block diagrams can be produced using clusters
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Enum or Enumerated Data type
▌ Sometimes you need a control to produce only one of
the predefined values rather than a range of values
▌ Enumerated data type helps you predefine the values
that a control can produce
▌ Enum are very helpful in defining states for a state
machine
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to use Enums
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Executables
▌ You need to distribute your LabVIEW applications to
your customers
▌ You can’t make them install a large software like
LabVIEW just to have application run on their PCs
▌ If LabVIEW application is converted to an executable
you can run it on any PC without the need for installing
LabVIEW
▌ User of an Executable cannot access the block diagram
hence your intellectual property is saved from prying
eyes
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Creating an Executable
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Password Protecting a VI
▌ You can password protect a VI to allow only authorized
access
▌ Two types of restrictions can be set:
VI opening restriction: In this restriction only person with a
password can open a VI
Block diagram opening restriction: In this restriction every
body can see the front panel of the VI however only
persons with a password can access the Block Diagram
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
How to Password Protect a VI
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Task 1
▌ Design a VI that takes two numeric inputs x and y and
one string input from the user.
If the string entered is add, then the vi displays x+y in the
result indicator
If the string entered is sub, then the vi displays x-y in the
result indicator
If the string entered is mean, then the vi displays (x+y)/2
in the result indicator
The user must not be able to put any string other than
add, sub and mean in the String Input
Refer to Task 1.vi in the Tasks folder if you have any
confusion about how the VI should behave
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Lab report for Task 1
The lab report must contain
▌ Picture of the front panel
Front panel should be neat and clean and user friendly
Give cosmetic touches to the front panel
▌ Picture of Block Diagram
Make clean block diagram
Wires should be as straight as possible
Unnecessary bends in the wire will make you lose marks
Note
Always write the Question before beginning to Answer
008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Task 1
▌ Design a VI that produces 100 random numbers
Each random number should be generated 50 ms after
the previous one
Display the random number as they are being generated
After all the random numbers have been generated,
arrange them in ascending order and then, display them
Both plots must have proper units
Both plot must display the random numbers in Discrete
Mode
Refer to Task 2.vi in the Tasks folder if you have any
confusion about how the VI should behave
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
Lab report for Task 2
The lab report must contain
▌ Picture of the front panel
Front panel should be neat and clean and user friendly
Give cosmetic touches to the front panel
▌ Picture of Block Diagram
Make clean block diagram
Wires should be as straight as possible
Unnecessary bends in the wire will make you lose marks
Note
Always write the Question before beginning to Answer
008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences
DARwIn
©2008-2009 All rights reserved.
CECOS University of IT & Emerging Sciences