LabVIEW Proficiency Workshop 2
-
Upload
meetnature -
Category
Documents
-
view
224 -
download
0
Transcript of LabVIEW Proficiency Workshop 2
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 1/29
Workshop2 of 7
Welcome!
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 2/29
Today's Topics
Review of Workshop 1
Basic VI Structure
Arrays
Clusters
Error Cluster Enumerations
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 3/29
Review Question 1
Which of the following are the three parts of a VI?
a) Front Panel
b) Project
c) Block Diagram
d) Connector Pane/Icon
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 4/29
Review Question 1
Which of the following are the three parts of a VI?
a) Front Panel
b) Project
c) Block Diagram
d) Connector Pane/Icon
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 5/29
Review Question 2
1. Which identifies the control or indicator on theblock diagram?
a) Caption
b) Location
c) Label
d) Value
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 6/29
Review Question 2
1. Which identifies the control or indicator on theblock diagram?
a) Caption
b) Location
c) Label
d) Value
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 7/29
Review Question 3
Which of the following are not a nodes?
a) Terminals
b) Structures (while loop, for loop)
c) subVIs
d) Wires
e) Functions
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 8/29
Review Question 3
Which of the following are not a nodes?
a) Terminals
b) Structures (while loop, for loop, etc.)
c) subVIs
d) Wires
e) Functions
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 9/29
Which function executes first: Add or Subtract?
a) Add
b) Subtract
c) Unknown
9
Review Question 4
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 10/29
Which function executes first: Add or Subtract?
a) Add
b) Subtract
c) Unknown
10
Review Question 4
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 11/29
• Acquire
• Analyze
• Present
Basic VI Structure
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 12/29
An array consists of elements and dimensions
Elements: data that make up the array
Dimension: the length, height, or depth of an array
(231) –1 elements per dimension, memory permitting
1 or more dimensions
Arrays
Elements (numeric, here)Index, tells dimension(1D, here)
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 13/29
Arrays: the index The index (zero-based) tells you :
• the dimension of the array (1D, 2D, 3D, etc.)
• the index of the element displayed in the upper left corner
- the 1D array below is displaying index 1 to contain a value of 3.00; we donot know the value of index 0 from this image because the value at index0 is hidden from view
1D Array (initialized)2D Array (uninitialized)
indexTIP: drag the edge of the index to add another dimension to an
(row)
(column)
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 14/29
Arrays: the elements
• Arrays can be of many different data types, butonly one data type at a time
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 15/29
Arrays: Initialized and Uninitialized
• If the elements of an array are grayed out, thenthose elements are uninitialized.
• Uninitialized elements do not have a value andare place holders
Uninitialized elements
Initialized elements
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 16/29
Arrays: Size vs. Dimension
• Size is the number of initialized elements in each dimension
• Dimension is how the elements are organized
Size: 4Dimension: 1D
Size: 2x3x?Dimension: 3D
Size: 0x0Dimension: 2D
Size: at least 4 – more elements could be hiddenDimension: 1D
Size: 4Dimension: 1D
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 17/29
Creating an Array
1. Place an array shell on the front panel
From the Controls»Modern»Array, Matrix,and Cluster subpalette, select the Array icon.
2. Drag a data object or element into thearray shell
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 18/29
Demonstration 1:
Creating an array
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 19/29
- Array Size:
- Returns the number ofelements in eachdimension of the array
- Index Array:- Returns the value at
the index you specify
- Initialize Array:
- Creates an initializedarray of the dimensionand data type youspecify
- Build Array:
- Adds elements ordimensions to anarray
- Search 1D Array:
- Returns the index ofthe value you specify;if not found, returns -1
Array Functions
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 20/29
• Clusters group data elements of mixed types
• Similar to a record or a struct in text-basedprogramming languages
Clusters
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 21/29
Cluster Functions
Bundle (there is also Unbundle) Assembles a cluster from individual elements.
Bundle By Name (there is also Unbundle By Name) Replaces one or more cluster elements. This function refers to cluster
elements by name instead of by their position in the cluster.
Cluster Constant Use this constant to supply a constant cluster value to the block diagram.
(Terminal labels
reflect data type)
Bundle By NameBundle
ClusterConstant
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 22/29
• Cluster elements have a logicalorder unrelated to their position inthe shell
• You can view and modify the
cluster order by right-clickingthe cluster border andselecting Reorder ControlsIn Cluster from
the shortcut menu
• Order determines how cluster isunbundled
Clusters: Order
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 23/29
•Three parts:• Status – Boolean, TRUE when an error occurred • Code - numeric (I32), identifies which error occurred • Source – string, identifies where the error occurred
Error Cluster
Note: Warnings have a code andsource, but the status is FALSE
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 24/29
Demonstration 2:
Creating a cluster and reordering itselement
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 25/29
• Clusters differ from arrays in that they are a fixed size
• Clusters can contain mixed data types; arrays contain onlyone data type
• Like an array, a cluster is either a control or an indicatorand cannot contain a mixture of controls and indicators
• You can create a cluster of clusters, cluster of arrays,array of clusters, but NOT an array of arrays
Clusters vs. Arrays
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 26/29
Enumeration
• An enum represents a pair of values, a string anda numeric, where the enum’s value is one of adefined list of value pairs
• Appears as a string to you, and a number to computer
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 27/29
Enumeration: Configuring1. Right-click on the enum
2. Select Edit Items…
8/4/2019 LabVIEW Proficiency Workshop 2
http://slidepdf.com/reader/full/labview-proficiency-workshop-2 28/29
Demonstration 3:
Configuring an Enum