Professional Documents
Culture Documents
LabVIEW Core 2 TM
rib en
Exercises
on
ist um
r D str
Course Software Version 2011
August 2011 Edition
Part Number 325293C-01
LabVIEW Core 2 Exercises
t fo l In
Copyright
© 1993–2011 National Instruments Corporation. All rights reserved.
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including
photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent
of National Instruments Corporation.
National Instruments respects the intellectual property of others, and we ask our users to do the same. NI software is protected by
copyright and other intellectual property laws. Where NI software may be used to reproduce software or other materials belonging to
No na
others, you may use NI software only to reproduce materials that you may reproduce in accordance with the terms of any applicable
license or other legal restriction.
For components used in USI (Xerces C++, ICU, HDF5, b64, Stingray, and STLport), the following copyright stipulations apply. For a
listing of the conditions and disclaimers, refer to either the USICopyrights.chm or the Copyrights topic in your software.
Xerces C++. This product includes software that was developed by the Apache Software Foundation (http://www.apache.org/).
tio
Stingray. This software includes Stingray software developed by the Rogue Wave Software division of Quovadx, Inc.
Copyright 1995–2006, Quovadx, Inc. All Rights Reserved.
STLport. Copyright 1999–2003 Boris Fomitchev
Trademarks
LabVIEW, National Instruments, NI, ni.com, the National Instruments corporate logo, and the Eagle logo are trademarks of National
Instruments Corporation. Refer to the Trademark Information at ni.com/trademarks for other National Instruments trademarks.
Other product and company names mentioned herein are trademarks or trade names of their respective companies.
Members of the National Instruments Alliance Partner Program are business entities independent from National Instruments and have
no agency, partnership, or joint-venture relationship with National Instruments.
Patents
For patents covering National Instruments products/technology, refer to the appropriate location: Help»Patents in your software,
the patents.txt file on your media, or the National Instruments Patent Notice at ni.com/patents.
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
For further support information, refer to the Additional Information and Resources appendix. To comment on National Instruments
documentation, refer to the National Instruments Web site at ni.com/info and enter the Info Code feedback.
Contents
Student Guide
uti ts
A. NI Certification .....................................................................................................v
B. Course Description ...............................................................................................vi
C. What You Need to Get Started .............................................................................vii
D. Installing the Course Software..............................................................................vii
rib en
E. Course Goals.........................................................................................................viii
F. Course Conventions ..............................................................................................ix
on
Lesson 2
ist um
Synchronization Techniques
Exercise 2-1 Concept: Comparing Queues With Local Variables ........................2-1
Lesson 3
Event Programming
r D str
Exercise 3-1 Concept: Experiment with Event Structures ....................................3-1
Exercise 3-2 Create a Print Queue Console...........................................................3-4
Lesson 4
t fo l In
Error Handling
Exercise 4-1 Updating the Print Console With Error Handling ............................4-1
Lesson 5
Controlling the User Interface
No na
Lesson 6
tio
Lesson 7
Improving an Existing VI
Exercise 7-1 Concept: Refactoring a VI................................................................7-1
Lesson 8
Creating and Distributing Applications
Exercise 8-1 Preparing Files for Distribution........................................................8-1
Exercise 8-2 Creating a Stand-Alone Application ................................................8-7
Appendix A
Setting Up Your Hardware
Appendix B
uti ts
Additional Information and Resources
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
Thank you for purchasing the LabVIEW Core 2 course kit. You can begin
developing an application soon after you complete this course. This exercise
uti ts
manual and the accompanying software are used in the two-day, hands-on
LabVIEW Core 2 course.
rib en
You can apply the full purchase of this course kit toward the corresponding
course registration fee if you register within 90 days of purchasing the kit.
on
Visit ni.com/training for online course schedules, syllabi, training
centers, and class registration.
ist um
A. NI Certification
The LabVIEW Core 2 course is part of a series of courses designed to build
your proficiency with LabVIEW and help you prepare for the NI Certified
LabVIEW Associate Developer exam. The following illustration shows the
r D str courses that are part of the LabVIEW training series. Refer to ni.com/
training for more information about NI Certification.
t fo l In
New User Experienced User Advanced User
Courses
Object-Oriented Design
and Programming
in LabVIEW
LabVIEW Performance
Certifications
tio
Other Courses
LabVIEW FPGA LabVIEW DAQ and Signal Conditioning Modular Instruments Series
*Core courses are strongly recommended to realize maximum productivity gains when using LabVIEW.
B. Course Description
The LabVIEW Core 2 course teaches you programming concepts,
techniques, features, VIs, and functions you can use to create test
uti ts
and measurement, data acquisition, instrument control, datalogging,
measurement analysis, and report generation applications. This course
assumes that you are familiar with Windows; that you have experience
rib en
writing algorithms in the form of flowcharts or block diagrams; and that you
have taken the LabVIEW Core 1 course or have equivalent experience. The
on
course and exercise manuals are divided into lessons, described as follows.
ist um
• An introduction that describes the purpose of the lesson and what
you will learn
• A description of the topics in the lesson
r D str • A summary quiz that tests and reinforces important concepts and
skills taught in the lesson
Note For course and exercise manual updates and corrections, refer to ni.com/info
and enter the Info Code core2.
No na
If you do not have this hardware, you still can complete the exercises.
tio
uti ts
❑ Windows XP or later installed on your computer; this course is
optimized for Windows XP
rib en
❑ Multifunction DAQ device configured as Dev1 using Measurement &
Automation Explorer (MAX)
on
❑ DAQ Signal Accessory or BNC-2120, wires, and cable
ist um
❑ LabVIEW Professional Development System 2011 or later
Directory Description
Exercises Contains VIs used in the course
t fo l In
Note Folder names in angle brackets, such as <Exercises>, refer to folders on the root
Na
E. Course Goals
This course prepares you to do the following:
• Apply common design patterns that use notifiers, queues, and events
uti ts
• Use event programming effectively
• Programmatically control user interface objects
rib en
• Evaluate binary file I/O formats and use them in applications
• Modify existing code for improved usability
on
• Prepare, build, and deploy stand-alone applications
ist um
You will apply these concepts as you build a project that uses VIs you create
throughout the course. While these VIs individually illustrate specific
concepts and features in LabVIEW, they constitute part of a larger project
built throughout the course.
r D str This course does not describe any of the following:
• LabVIEW programming methods covered in the LabVIEW Core 1
course
• Every built-in VI, function, or object; refer to the LabVIEW Help for
t fo l In
more information about LabVIEW features not described in this course
• Developing a complete application for any student in the class; refer to
the NI Example Finder, available by selecting Help»Find Examples,
for example VIs you can use and incorporate into VIs you create
No na
tio
Na
F. Course Conventions
The following conventions appear in this course manual:
uti ts
» The » symbol leads you through nested menu items and dialog box
options to a final action. The sequence Tools»Instrumentation»Find
Instrument Drivers directs you to drop down the Tools menu, select the
rib en
Instrumentation item, and finally select the Find Instrument Drivers
option.
on
This icon denotes a tip, which alerts you to advisory information.
ist um
This icon denotes a note, which alerts you to important information.
bold Bold text denotes items that you must select or click in the software, such as
menu items and dialog box options. Bold text also denotes sections of dialog
boxes and hardware labels.
t fo l In
italic Italic text denotes variables, emphasis, a cross-reference, or an introduction
to a key concept. Italic text also denotes text that is a placeholder for a word
or value that you must supply.
monospace Text in this font denotes text or characters that you should enter from the
keyboard, sections of code, programming examples, and syntax examples.
No na
This font is also used for the proper names of disk drives, paths, directories,
programs, subprograms, subroutines, device names, functions, operations,
variables, filenames, and extensions.
tio
monospace bold Bold text in this font denotes the messages and responses that the computer
automatically prints to the screen. This font also emphasizes lines of code
that are different from the other examples.
Na
uti ts
Exercise 2-1 Concept: Comparing Queues With Local
rib en
Variables
on
Goal
In this exercise, you run and examine a prebuilt producer/consumer design
ist um
pattern VI that transfers data generated by the producer loop to each of the
consumer loops using local variables and queues.
Description
1. Open Queues vs Local Variables.vi in the <Exercises>\
r D str LabVIEW Core 2\Queues versus Local Variables directory.
The front panel of this VI is shown in Figure 2-1.
t fo l In
No na
tio
Na
2. Run the VI. The producer loop generates data and transfers it to each
consumer loop using a local variable and a queue.
uti ts
rib en
on
ist um
r D str
t fo l In
Creating a Queue
The Obtain Queue function, placed to the left of the Producer Loop, creates
No na
the queue.
The My Data string constant, wired to the name (unnamed) input of the
Obtain Queue function, assigns a name to the queue you want to obtain or
create.
tio
The Data Type numeric constant, wired to the element data type input of the
Obtain Queue function, specifies the type of data that you want the queue to
contain.
Na
uti ts
Queue’s Consumer Loop waveform graph.
The Get Queue Status function inside the Queue’s Consumer Loop indicates
rib en
how many elements remain in the queue. In order to process these data
elements, you must execute the Queue’s Consumer Loop faster than the
on
Producer Loop, or continue to process after the Producer Loop has stopped.
ist um
The While Loop inside the Flat Sequence structure waits for the queue to
empty before stopping the VI. Refer to this While Loop as the Queue Wait
Loop.
The Get Queue Status function inside the Queue Wait Loop returns
r D str information about the current state of the queue, such as the number of data
elements currently in the queue.
The Equal To 0? function wired to the stop condition of the Queue Wait
Loop checks if the queue is empty.
t fo l In
The Release Queue function to the right of the Queue Wait Loop releases
and clears reference to the queue.
The Simple Error Handler to the right of the Release Queue function reports
any error at the end of execution.
No na
wave data from the same local variable. The Points Difference VI inside the
Local Variable’s Consumer Loop outputs the number of missed points or
number of duplicate points read out.
1. Select the loop time speed of the Local Variable’s Consumer Loop and
observe the Local Variable’s Consumer Loop waveform graph and the
results generated on the Duplicate Points indicator.
❑ Ensure that the Loop Speed selected is Same as Producer Loop and
observe the waveform graphs for both the Producer Loop and the
Local Variable’s Consumer Loop. A race condition may occur
resulting in missed points or duplicated data.
uti ts
read the same value multiple times.
❑ Select 1/2 as Producer from the pull-down menu of the Loop Speed
control and observe the waveform graph of the Local Variable’s
rib en
Consumer Loop. A race condition occurs because data is produced
faster than it is consumed. The data changes before the local variable
on
has a chance to read it.
ist um
❑ Select the remaining options available from the pull-down menu of
the Loop Speed control and observe the data retrieval.
the producer and consumer loops are executing at the same rate.
❑ Select 1/2 as Producer from the pull-down menu of the Loop Speed
control and observe the value of # of elements in queue. The data
points will accumulate in the queue. You will need to process the
accumulated elements in the queue before reaching the maximum
uti ts
size of the queue to avoid data loss.
rib en
transfer between the producer loop and the consumer loop using
queues.
on
2. Stop the VI.
ist um
When the Producer Loop and Queue’s Consumer Loop run at the same
speed, the number of elements in the queue remains unchanged. When
the Queue’s Consumer Loop runs slower, the queue quickly backs up
and the Producer Loop must wait for the Queue Consumer Loop to
remove the elements. When the Queue’s Consumer Loop runs faster,
r D str the queue is quickly emptied and the consumer loop must wait for the
Producer loop to insert elements. Hence queues synchronize the data
transfer between the two independent parallel loops and thus avoid loss
or duplication of data.
t fo l In
3. Close the VI. Do not save changes.
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
Exercise 3-1 Concept: Experiment with Event Structures
rib en
Goal
on
Experiment with the operation of the Event structure in a VI.
ist um
Description
Use and modify a VI that contains an Event structure.
6. Observe the operation of the VI when you click the buttons on the front
panel.
❑ Change the button text and label of the button to New Button.
❑ Right-click the new button and verify that the Mechanical Action is
set to Latch When Released.
❑ Right-click the border of the Event structure and select Add Event
Case from the shortcut menu to open the Edit Events dialog box.
uti ts
❑ Select New Button in the Event Sources section and select Value
Change in the Events section as shown in Figure 3-1.
rib en
on
ist um
r D str
t fo l In
No na
❑ Place the New Button control in the New Button event case.
Na
❑ Add a One Button Dialog function in the New Button event case
and wire a string constant to the message input. Set the string
constant to New Event Case.
❑ Run the VI and click New Button. A dialog box should open and
display the New Event Case message.
uti ts
10. Modify the Event structure to add a Filter Event to discard the Panel
Close event.
rib en
❑ Right-click the Event structure and select Add Event Case from
the shortcut menu to open the Edit Events dialog box.
on
❑ Select <This VI> in the Event Sources section.
ist um
❑ Select Panel Close? from the Events section and click the OK
button.
❑ Wire a True constant to the Discard? Event Filter Node in the Panel
r D str Close? case.
18. Observe the operation of the Old Event Handler VI and compare and
contrast the operation with the New Event Handler VI.
uti ts
Use the Producer/Consumer (Event) template to create a print queue
console that submits print jobs to a printer and monitors the print queue.
Scenario
rib en
You must create a print console VI that controls print job submissions and
on
monitors the processing status of the print jobs. Each time the user clicks on
the Queue Event button, a print job will be sent to the printer. You will
monitor the number of print jobs in the queue using a vertical bar. LEDs will
ist um
indicate the print processing status.
The print process for each job includes two steps—an initialization stage
with a fixed duration of 300 ms and a print stage with a varying duration
r D str based on the size of the job.
Design
The controls and type definition enums necessary for this project are already
created. Your task is to use the Producer/Consumer design pattern template
that ships with LabVIEW to create the print console VI. Table 3-1 lists the
t fo l In
controls and indicators used in the front panel of the print console VI.
Controls/Indicators Description
No na
Queue Event button Each time the user clicks on this button, a print job is sent to the printer.
Queued Print Jobs bar This bar displays the number of print jobs that are currently in the print
queue. Each time a print job is sent to the printer, a new job is added to
the queue. When the printer starts a new job, the print job is removed
tio
Printing LED This LED is turned on for the duration of the print stage for each print
job.
Stop Button This button stops the VI.
Table 3-2 lists the Event cases you will implement in the producer loop.
uti ts
Enqueue Element10: In this case, you use the Enqueue Element function to queue a
Value Change string constant with the value of print job.
rib en
Stop: Value Change In this case, you stop the While Loop.
on
Timeout In this case, you use the Get Queue Status function to get the
number of elements in the queue. You pass the value to the
ist um
Queued Print Jobs bar.
Table 3-3 lists the states you will implement in the consumer loop state
machine.
r D str Table 3-3. Consumer Loop States
uti ts
• Set the Printing LED to True.
• Transition to the Print state.
rib en
Print You perform the following tasks in this state.
• Simulate the print job using a variable wait time.
on
• Set the Printing LED to False.
ist um
• Transition to the Wait state.
Implementation
Note To reinforce the development skills you have learned so far, you are given limited
instructions to create the application.
r D str
Create a New VI From a Template
1. Open Print Console.lvproj in the <Exercises>\
LabVIEW Core 2\Print Console directory.
t fo l In
of your application.
uti ts
1
rib en
on
ist um
r D str 1 Already created in Print Console.lvproj
Figure 3-2. Print Console Front Panel
t fo l In
Producer Loop
Complete the block diagram by first modifying the producer loop and then
modifying the consumer loop.
The producer loop responds to front panel events. Each time the user clicks
the Enqueue Element button, a print job is added to the queue. The producer
No na
loop is also responsible for updating the Queued Print Jobs bar with the
number of elements in the queue.
tio
Na
Figure 3-3 and Figure 3-4 are examples of the completed producer loop.
uti ts
rib en
on
ist um
r D str Figure 3-3. Producer Loop—Enqueue Element Case
1. In the Enqueue Element case, replace the element string with print
job in the Enqueue Element function.
t fo l In
2. Add a Timeout case to the Event structure. The Timeout case updates the
Queued Print Jobs bar by reading the number of elements in the queue.
Note If the Event Data Node label is invalid (black text), right-click the label and select
a valid one.
Note Because the Timeout case is an application event, the Event Selector label at the
tio
top of the Timeout case differs from other events associated objects. The label name only
specifies the event and does not include the associated object.
Na
uti ts
rib en
on
ist um
Figure 3-4. Producer Loop—Timeout Event Case
❑ Set the Event structure to time out every 100 ms by wiring a constant
value of 100 to the Timeout terminal.
t fo l In
Note You do not need to make any changes to the Stop case as it already exists in the
template.
Consumer Loop
The consumer loop simulates the print process and updates the LEDs.
No na
Implement the print process using a state machine. The Wait state receives
print jobs. When a print job is received, the state machine initiates a series
of steps to simulate the print process. The Print LEDs update after each
state. Therefore, the Initializing LED turns on after the Initialize Setup state
tio
and turns off after the Setup state. Similarly, the Printing LED turns on after
the Initialize Print state and turns off after the Print state.
Na
Figures 3-5 through 3-9 are examples of the completed consumer loop.
1. Create a state machine in the consumer loop by starting with the Wait
state. The Wait state receives print jobs using the Dequeue Element
uti ts
function. If the Dequeue Element function receives a queue element
within the specified 100 ms timeout the state machine transitions to the
Initialize Setup state. If the Dequeue Element function times out, the
state machine stays in the Wait state.
rib en
on
ist um
1
r D str
1 Already created in Print Console.lvproj
t fo l In
Figure 3-5. Consumer Loop—Wait Case
❑ The print processing states type definition enum is created for you.
Select and drag the Print Processing States.ctl from the Project
Explorer window onto the block diagram.
No na
❑ Drag the Print LEDs.ctl from the Project Explorer window onto the
block diagram to create a Print LEDs cluster constant on the block
diagram.
uti ts
rib en
on
ist um
Figure 3-6. Consumer Loop—Initialize Setup Case
r D str ❑ To create cases associated with each of the enum values, right-click
the edge of the Case structure and select Add Case for Every
Value.
Tip Alternatively, you can also create new cases by duplicating existing cases.
To duplicate a case, right-click the edge of the Case structure and select Duplicate Case.
t fo l In
Be careful when duplicating cases that include front panel terminals as this will result in
duplicated front panel objects.
uti ts
rib en
on
ist um
Figure 3-8. Consumer Loop—Initialize Print Case
Test
1. Run the VI to confirm that it behaves correctly. Each time you click the
Queue Event button, a new print job is submitted to the print queue. If
you submit several print jobs in succession, you will see a backlog of
uti ts
print jobs in the Queued Print Jobs bar.
❑ Notice that after you stop queueing the print jobs, the print process
rib en
continues to execute.
❑ Notice that the consumer loop stops only when there is an error. This
on
occurs when the producer loop stops and the Release Queue function
destroys the queue reference. Without a valid queue reference, the
ist um
Dequeue Element function in the consumer loop returns error code
1122 with an explanation of Refnum became invalid while
node waited for it or an error code 1 with an explanation of
An input parameter is invalid (if there are elements left in
r D str the queue when you press stop).
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
Exercise 4-1 Updating the Print Console With Error Handling
rib en
Goal
on
Update a VI to report errors and include a shutdown state.
ist um
Scenario
You begin with a Print Console VI that simulates the control of print job
submissions and monitors the status of the print jobs being processed. Each
time you click the Queue Event button, you send a print job to the printer.
r D str You monitor the number of print jobs in the queue using a vertical bar. You
use LEDs and a numeric indicator to monitor the process of the print jobs.
The Print Console VI does not report errors. You must update the VI to
report potential errors and warnings.
t fo l In
You must also complete a shutdown procedure after the last print job.
Design
To implement error reporting, you must do the following.
❑ Use shift registers to monitor and track errors and warnings for all loop
No na
iterations.
❑ Use the Merge Errors function to obtain error information from both the
producer and consumer loops.
tio
❑ Use the Simple Error Handler VI to display both errors and warnings.
❑ Use an error handling VI that causes the state machine to execute the
shutdown case when an error occurs or when the producer loop sends a
Na
shutdown message.
Implementation
1. Open Print Console with Error Handling.lvproj in the
<Exercises>\LabVIEW Core 2\Error Handling directory.
uti ts
rib en
on
ist um
r D str
Figure 4-1. Front Panel of Print Console
t fo l In
2. Open and run the Print Console VI. The front panel of this VI is shown
in Figure 4-1.
❑ Each time you click the Queue Event button, you add a print job to
the queue. The Queued Print Jobs bar displays the backlog of print
jobs.
No na
❑ When there are no print jobs in the queue, the Waiting LED is turned
on. When each print job is processed the Job Number indicator is
updated to show the number of print jobs that have been processed.
tio
❑ Notice that the consumer loop stops only when there is an error. This
occurs when the producer loop stops and the Release Queue function
destroys the queue reference. Without a valid queue reference, the
Dequeue Element function in the consumer loop returns error code
1122 with an explanation of Refnum became invalid while
node waited for it.
uti ts
rib en
on
ist um
r D str
t fo l In
No na
❑ Wire the error cluster of the Obtain Queue function to the consumer
While Loop.
tio
❑ Replace the error tunnel on the While Loop with a shift register.
❑ Wire the error cluster from the left shift register to the error in input
of the Dequeue Element function.
Na
2. In the Initialize Setup case, wire the left-side error cluster tunnel to the
error in terminal of the Scan from String function.
3. For all the remaining cases, wire the left-side error cluster tunnel to the
right-side error cluster tunnel.
uti ts
❑ Right-click on the type of dialog terminal of the Simple Error
Handler VI and select Create»Constant.
rib en
❑ Select OK Message + warnings.
on
Note By default, the Simple Error Handler VI only displays a dialog when an error
occurs. To report both warnings and errors, change the dialog selection to OK Message +
ist um
warnings.
3. Complete wiring the Merge Errors function and the Simple Error
Handler VI as shown in Figure 4-3.
r D str
t fo l In
No na
tio
Na
Figure 4-3. Block Diagram with Merge Errors Function and Simple Error Handler VI
❑ Notice that the VI does not stop when you click the Stop button.
You must stop the VI using the Abort button.
uti ts
5. Examine the block diagram.
❑ Notice that the Merge Errors function cannot execute until both the
rib en
producer and consumer loops terminate. Therefore, the Release
Queue function cannot destroy the queue reference that the
on
consumer loop relies on to stop the loop. Moving the Release Queue
function before the Merge Errors function will cause the consumer
ist um
loop to stop. However, relying on an error to stop the loop will cause
the Simple Error Handler VI to report an error every time the VI
runs. You will fix this when you modify the Shutdown state in the
consumer loop.
uti ts
End function.
rib en
shortcut menu.
on
– Type Shutdown in the string constant.
ist um
Note The text in this string constant is case sensitive.
❑ Notice that the Next State is the same as the State In, except when
the error in cluster contains an error or the Queue Data value is equal
to Shutdown. If there is an error or a Shutdown match, the next state
is Shutdown.
uti ts
6. Save and run the Print Console VI.
❑ Notice that the VI stops when you click the Stop button and no error
is reported.
rib en
❑ Although the VI appears to work as you expect, you should force
on
errors and warnings to test your error handling.
ist um
Test (Optional)
Time permitting, try inserting errors and warnings in your code and running
the VI to test the error handling. You can force errors by breaking one of the
error wires and replacing it with an Error Code Constant that has the status
r D str and code values set for an error or warning.
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
Exercise 5-1 Display Temperature and Limits
rib en
Goal
on
Use Property Nodes to change the properties of front panel objects
programmatically.
ist um
Scenario
Complete a VI that records temperature to a waveform chart. During
execution, the VI performs the following tasks:
Design
Add the following Property Nodes to an existing VI:
No na
Implementation
1. Open Temperature Limit.vi located in the <Exercises>\
LabVIEW Core 2\Temperature Limit directory. The front panel is
already created for you.
uti ts
rib en
on
ist um
r D str Figure 5-1. Temperature Limit Front Panel
2. Open the block diagram of the VI. A portion has been created for you.
Figure 5-2 shows an example of the final block diagram.
t fo l In
No na
tio
Na
3. Modify the VI so that it sets the Δx value of the chart to the Δt (ms) value
input by the user.
❑ Place the new Property Node to the left of the While Loop.
uti ts
❑ Divide delta t (ms) by 1000 to determine the X-Scale Multiplier,
as shown in Figure 5-2.
rib en
4. Modify the VI to clear old data from the Temperature chart before
starting the temperature acquisition.
on
Tip To clear a waveform chart from the block diagram, send an empty array of data to
ist um
the History Data property.
5. Modify the VI so that when the VI acquires data, it turns the Data trace
red and the Over Limit LED blinks when the temperature exceeds the
limit value.
No na
❑ Place the new Property Node in the True case of the Case structure.
tio
❑ Wire the Red color box constant to the Plot Color property to set the
plot color to red when the data rises above the High Limit.
Tip Do not use the clipboard (Edit»Copy or <Ctrl-C>) to create a copy of the Property
uti ts
Node. This creates a different type of Property Node that you learn about in the Control
References section of Lesson 5, Controlling the User Interface, in the LabVIEW Core 2
Course Manual.
rib en
❑ Place the copy of the Property Node in the False case of the Case
on
structure, as shown in Figure 5-3.
ist um
property to select the first plot on the Temperature chart.
❑ Wire the Green color box constant to the Plot Color property to set
the plot color to green when the data is below the High Limit.
r D str
t fo l In
Figure 5-3. False Case in the Temperature Limit VI
6. Modify the VI so that when the VI acquires data, the Over Limit LED
blinks when the temperature exceeds the limit value.
Test
1. Run the VI to confirm that it behaves correctly.
uti ts
Affect the attributes of a VI by using Property Nodes and Invoke Nodes.
Scenario
rib en
You can set the appearance properties of a VI statically by using the VI
properties page. However, robust user interfaces often must modify the
on
appearance of a front panel while the program runs.
You must create a VI that can perform the following tasks on demand:
ist um
• Show or hide its title bar
• Show or hide its menu bar
• Become transparent so that objects behind the VI can be seen
r D str • Move to the center of the screen
Design
Inputs and Outputs
t fo l In
Type Name Default Value
Push Button Show Menu Bar? True
Push Button Show Title Bar? True
No na
TipUse the Push Button controls because their default mechanical action is Switch
When Pressed. Use the OK button because its default action is Latch When Released.
Na
Properties
Use the following properties and methods on the VI class:
uti ts
visible.
rib en
Figure 5-4. VI Menu Bar
on
• TitleBarVisible—When this property is true, the title bar of the VI is
visible.
ist um
Figure 5-5. VI Title Bar
Methods
Unlike properties, a method has an effect every time you call it. Therefore,
you should call methods only when you want to perform an action. For
example, if you call the Fp.Center method during each iteration of a loop,
tio
the VI is continually centered, thereby preventing the user from moving it.
You can use a Case structure to control calling the method in a given
iteration of a loop. Use the following method on the VI class:
the screen.
Tip Use the Context Help window to view descriptions of each property and method.
VI Structure
The VI polls the front panel controls every 50 ms and sets the value of the
properties based on the current value of the controls. A Case structure
controls the execution of the Center method.
Implementation
1. Open the Customize VI Window VI from <Exercises>\LabVIEW
Core 2\Customize VI Window directory. The front panel of this VI
is shown in Figure 5-6.
uti ts
rib en
on
ist um
Figure 5-6. Customize VI Window VI Front Panel
Note Using the This VI reference you can access all the methods and properties of the
current VI without having to explicitly open and close a reference.
uti ts
❑ Right-click the This VI reference and select Create»Property for
VI Class»Front Panel Window»Run VI Transparently from the
shortcut menu to create a Property Node.
rib en
❑ Move the Property Node to the right of the This VI reference,
on
outside of the While Loop.
❑ Right-click the Property Node and select Change All to Write from
ist um
the shortcut menu.
❑ Click the second item in the Property Node and select Front Panel
Window»Title Bar Visible.
No na
❑ Click the third item in the Property Node and select Front Panel
Window»Transparency.
❑ Right-click the Property Node and select Change All to Write from
tio
❑ Add two numeric constants with values 0 and 50 to the left of the
Select function.
uti ts
Invoke Node.
rib en
8. Add a 50 ms wait to the loop.
on
❑ Add a Wait (ms) function to the While Loop.
ist um
Constant from the shortcut menu.
r D str 9. Set the While Loop to stop when the user clicks the Stop button or when
an error occurs.
❑ Wire the Simple Error Handler VI to the error cluster output shift
register from the While Loop.
tio
Test
1. Switch to the front panel window of the VI.
Na
uti ts
Use control references to create a subVI that modifies graph or chart
properties.
Scenario
rib en
Create a subVI that allows you to assign a list of plot names to a chart or
on
graph. The subVI should resize the plot legend as necessary to display all of
the plots.
ist um
Design
Inputs and Outputs
Control References
No na
Both the Waveform Chart and the Waveform Graph are objects in the
GraphChart class. To write a subVI that can accept references to both
charts and graphs you must use a weakly typed control reference of the
GraphChart class. However, this class also contains other charts and graphs,
such as the XY Graph. This subVI generates an error if the user wires any
tio
type of graph other than a Waveform Chart or a Waveform Graph. You can
determine if the user has wired the correct type by using the ClassName
property to control a Case structure. If the correct class is wired, use the
To More Specific Class function to get a reference to the appropriate
Na
Properties
Graphs and charts do not have a single property to set all of the plot names.
Instead you must use a combination of properties to set each plot name.
In this exercise, use the following properties:
uti ts
• ClassName—This property returns a string indicating the control class
of the object that the property is called on. You can access this property
rib en
for any control.
on
automatically resizes to accommodate the plot names within it. Before
modifying the plot names you should set this property to False.
ist um
Otherwise, the legend may resize in such a way that it is separated from
the graph or covers the graph or other controls.
Implementation
No na
uti ts
❑ Add an error out cluster.
rib en
on
ist um
r D str
Figure 5-9. Set Plot Names Front Panel
t fo l In
Tip Because the front panel of this subVI is not displayed to the user, you do not have
to put as much effort into making it visually appealing. You should always organize your
front panels logically. However, you should not spend too much time on panels that the
user does not see.
5. Identify the class of the control reference and generate an error if it has
an invalid class.
❑ Use the Class Browser to find and drop the ClassName Property
tio
Node.
uti ts
rib en
on
ist um
r D str
t fo l In
– Type Class Name in the search field. Class Name should be the
only item in the Search results.
No na
uti ts
rib en
on
ist um
r D str
t fo l In
– Click the Create button and then move your mouse to an empty
area on the block diagram. Click on the block diagram to drop
the ClassName Property Node.
No na
uti ts
rib en
on
ist um
Figure 5-12. Default Case
❑ Delete the False text in the case name so that the case name
resembles Figure 5-12.
The Default case of the Case structure is selected if the class of the
control reference does not match one of the other cases. In this case,
No na
if the default case executes, then the control reference passed to this
subVI is not a WaveformGraph or a WaveformChart. Remember for
a Case structure, the case selector label is case sensitive.
tio
❑ Right-click the error code input of the Error Cluster From Error
Code VI and select Create»Constant from the shortcut menu.
Na
uti ts
rib en
on
ist um
Figure 5-13. WaveformGraph Case
Caution The text entered the case selector label must exactly match the input string,
t fo l In
including spaces and case. For this example, enter WaveformGraph.
❑ Click the constant you created in the previous step and select the
Generic»GObject»Control»GraphChart»WaveformGraph»
WaveformGraph class.
tio
❑ Use the Class Browser window to find and drop the Legend:
Autosize Property Node inside the Case structure.
– Class: Generic»Generic
uti ts
❑ Click the second property in the Property Node and select Legend»
Number of Rows.
rib en
❑ Right-click the Property Node and select Change All To Write
from the shortcut menu.
on
❑ Right-click the LegAutosize property and select Create»Constant
ist um
from the shortcut menu. Verify that the value of the constant is
False.
❑ Use the Class Browser window to find and drop the Active Plot
Property Node inside the For Loop.
t fo l In
– Object library: VI Server
– Class: Generic»Generic
WaveformGraph
❑ Wire the reference out output of the second Property Node through
the border of the For Loop to the reference input of the third
Property Node.
Na
❑ Click the second property in the Property Node and select Plot»
Plot Name from the list.
❑ Wire the block diagram as shown in Figure 5-13. Use shift registers
uti ts
when wiring the error wires through the For Loop. Confirm that auto
indexing is enabled on the Plot Names tunnel on the For Loop.
rib en
on
ist um
r D str
Figure 5-14. WaveformChart Case
t fo l In
❑ Right-click the border of the Case structure and select Duplicate
Case from the shortcut menu.
Caution The text entered in the case selector label must exactly match the input string,
including spaces and case. For this example, enter WaveformChart.
GObject»Control»GraphChart»WaveformChart.
Note When you change the class of a control reference, all Property Nodes and Invoke
Nodes using the reference become invalid because the properties refer to a class that does
not match the reference. Notice that all the property names change to black when you
Na
change the class reference and that the run arrow is broken. Leave the broken wires alone,
because the wires reconnect as you reselect the properties.
❑ Click each of the four properties and select the correct property
again. The four properties are Legend»Autosize, Legend»
Number of Rows, Active Plot, and Plot»Plot Name. The resulting
block diagram appears as shown in Figure 5-14.
9. Create the icon and connector pane for the subVI. Figure 5-15 shows an
example icon and connector pane.
uti ts
rib en
Connections Connector Pane
on
Figure 5-15. Connector Pane Connections for Set Plot Names VI
ist um
❑ Right-click the connector pane and select Patterns from the
shortcut menu to choose a pattern.
❑ Right-click the icon and select Edit Icon from the shortcut menu.
Test
1. Test the VI using a Waveform Graph.
No na
tio
Na
uti ts
❑ Add the Set Plot Names VI to the block diagram of the new VI.
Tip If the Set Plot Names VI is open, you can drag the icon from upper right corner of
rib en
its front panel to the block diagram of the new VI.
on
❑ Wire the WaveformGraph reference to the Graph Reference input
of the Set Plot Names VI.
ist um
❑ Right-click the Plot Names input of the Set Plot Names VI and
select Create»Control from the shortcut menu. The block diagram
should resemble Figure 5-16.
❑ Move the Plot Legend to the right of the graph so that you can
expand the legend.
t fo l In
Note The error is displayed because the control reference of the XY Graph is not
supported in the subVI.
4. Close the VI. You do not need to save the VI used for testing the Set Plot
uti ts
Names VI.
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
Exercise 6-1 Bitmap File Writer VI
rib en
Goal
on
Use Binary File I/O to write to a file using a specified format.
ist um
Scenario
Write a file storage routine to store image files for an existing
LabVIEW-based Drawing Pad. The drawing pad VI returns a drawing as a
2D array of red, green, and blue (RGB) values. Save the data as a 24-bit
r D str bitmap file.
Design
You can use binary file I/O to write or read data in any file format, assuming
that you have a specification that tells you the file layout for that format. The
following section describes the format for a 24-bit Windows bitmap file.
t fo l In
uti ts
Image Data—For a 24-bit image, three bytes represent each pixel in the
image. The three bytes represent the RGB values for the pixel and are stored
in reverse order, BGR. The pixel array you are given is a 2D array of
rib en
clusters. Each cluster has an RGB value in it. The rows in the Image Data
are stored from bottom to top, and the first pixel stored is the lower left
on
corner of the image.
ist um
Inputs and Outputs
The main VI for this program contains no inputs or outputs. Dialog boxes
control all user interaction. The Drawing Pad VI displays a dialog box that
allows the user to draw a picture. When the user clicks Save, the application
r D str prompts the user to enter a save location by using a File Dialog VI.
Program Flow
1. Call the Drawing Pad VI to create a picture.
t fo l In
Note The Drawing Pad VI returns the picture as a 2D array of clusters, each containing
RGB values. The 2D array has a width that is a multiple of four and is inverted in
preparation for writing to file.
2. Display a file dialog box to the user to select a location and filename and
open the selected file for writing.
No na
Note Disable the prepend array or string size option when you call the Write to
Binary File function, otherwise LabVIEW inserts the array size at the beginning of the
Na
7. Process each pixel in the array by using a pair of For Loops to remove
the values from the cluster in BGR order and build them into an array.
Note Use a 3D array to store the processed pixel data, because it allows you to use For
uti ts
Loop auto-indexing and simplify the program. The number of dimensions in the array is
not important, because the File I/O functions automatically reformat the array to write to
the file.
rib en
8. Write the processed pixel array to the open file.
on
9. Close the file and handle any errors.
ist um
Implementation
1. Display the drawing pad.
❑ Check the Show Front Panel when called and Close afterwards if
No na
Note The subVI node setup lets you specify how to call a subVI. Checking the
Show Front Panel when called box instructs the VI to show its front panel, even if the
VI properties would otherwise prevent it from doing so.
Na
❑ Run the VI and observe the drawing pad. Click the Save button to
exit. Currently, the program ends when you click Save, because you
have not yet implemented the file I/O.
❑ Click OK to exit the Configure File Dialog dialog box. The default
values allow the user to select a single new or existing file.
uti ts
❑ Right-click the prompt input of the File Dialog Express VI and
select Create»Constant from the shortcut menu.
rib en
❑ Enter Select File to Save in the string constant.
on
❑ Right-click the pattern label input of the File Dialog Express VI
and select Create»Constant from the shortcut menu.
ist um
❑ Enter Bitmap Files in the string constant.
❑ Right-click the pattern (all files) input of the File Dialog Express VI
and select Create»Constant from the shortcut menu.
uti ts
❑ Add two Write to Binary File functions to the block diagram.
rib en
❑ Right-click the prepend array or string size terminal of each Write
to Binary File function and select Create»Constant from the
on
shortcut menu.
ist um
❑ Wire the block diagram as shown in Figure 6-2.
Note You do not need to specify little-endian or big-endian for the byte order input
r D str of the Write to Binary File function because the array data type is only one byte.
t fo l In
No na
tio
❑ Wire the Image Data array through the For Loop borders to the
Unbundle By Name function.
uti ts
Note The bitmap file definition specifies that pixels must be stored in blue, green, red
order. Storing the pixels in another order causes the colors in your image to be incorrect.
rib en
❑ Add a Write to Binary File function to the block diagram.
on
❑ Right-click the prepend array or string size input of the Write to
Binary File function and select Create»Constant from the shortcut
ist um
menu.
Test
1. Run the VI.
uti ts
❑ Run the VI.
rib en
❑ Click Save.
on
❑ Select C:\Exercises\LabVIEW Core 2\Bitmap File
ist um
Writer\My Image.bmp as the file to save.
uti ts
Log data to a TDMS file and read the same TDMS file to access information
about a specific channel.
Scenario
rib en
You are given a TDMS Logger VI that generates measurement data for any
on
number of units under test (UUTs). The UUT measurement data consists of
a time domain waveform and the power spectrum of a waveform.
ist um
Run the TDMS Logger VI that accepts UUTs identified by serial numbers.
The TDMS Logger VI retrieves the measurement data from the Generate
Data VI, and logs the UUT data and additional properties to a TDMS file.
The TDMS file contains the author, timestamp, and two channel
groups—Time Data and Power Spectrum Data. Each group contains a
r D str channel for each UUT. The serial number of the UUT names each channel
and contains the matching signal data.
Saving data to a file serves no purpose unless you also can access the data.
Create a reader VI to access data from the TDMS file you generated. The
t fo l In
reader should return either time data or power spectrum data for a particular
UUT serial number.
Note Optionally, if you have Microsoft Excel installed on your system you can use the
the TDM Excel Add-In tool to load the TDMS file into Microsoft Excel.
No na
Design
TDMS File Reference Information
• File Level Information
tio
– The file contains two channel groups, one for time data and one for
the power spectrum data.
uti ts
– Signal—contains an array of floating-point numeric data.
rib en
will automatically be calculated and added to the file.
on
TDMS Reader Inputs and Outputs
ist um
Table 6-2. TDMS Reader VI Inputs and Outputs
Your VI should begin by opening the TDMS file and reading the author and
time stamp file properties. Then read the time data or power spectrum data
for the specified UUT and display the data on the Channel Data waveform
graph.
tio
Na
Implementation
TDMS Logger
1. Open TDMS Logger.vi in the <Exercises>\LabVIEW Core 2\
uti ts
TDMS Logger directory. This VI is pre-built for you as shown in
Figure 6-4.
rib en
on
ist um
r D str
t fo l In
No na
❑ Verify that the default value of the TDMS File Path control is
<Exercises>\LabVIEW Core 2\TDMS Logger\
Test Data.tdms.
Na
❑ Enter A001, A002, and A003 in the UUT Serial Numbers control.
❑ Run and test the TDMS Logger VI. View the logged data in the
TDMS File Viewer window. The graphs on the front panel of the
TDMS Logger VI should also display a plot for each serial number
you enter.
uti ts
TDMS Reader VI
rib en
1. Create a blank VI.
on
TDMS Reader.vi.
ist um
3. Build the VI front panel.
r D str
t fo l In
No na
❑ Place a combo box control on the front panel. Label the combo box
Data Set.
❑ Right-click the Data Set control and select Edit Items from the
shortcut menu.
❑ Click Insert.
uti ts
❑ Enter Power Spectrum in the Items list.
❑ Click Insert.
rib en
❑ Enter Time Data in the Items list.
on
❑ Deselect the Allow undefined values at run time box.
ist um
❑ Click OK.
❑ Select Time Data from the drop-down menu of the Data Set
control.
Note Opening a file with the open (read-only) option increases the speed of reads in the
file. Also, it does not lock the file so that other programs can use it at the same time.
tio
❑ Wire the TDMS File Path control to the file path input of the
TDMS Open function.
❑ Wire an empty string constant to the data type input of the TDMS
Get Properties function.
uti ts
function to the Test Operator string indicator.
rib en
❑ Add a TDMS Get Properties function to the block diagram.
on
❑ Right-click the property name input of the TDMS Get Properties
function and select Create»Constant from the shortcut menu.
ist um
❑ Enter Time Stamp in the string constant.
❑ Wire a time stamp constant to the data type input of the TDMS Get
Properties function.
7. Read the time data or power spectrum data for the specified UUT and
display the data on the Channel Data waveform graph.
t fo l In
❑ Add a TDMS Read function to the block diagram.
❑ Wire the Data Set control to the group name in input of the TDMS
Read function.
❑ Wire the data output of the TDMS Read function to the Channel
Data indicator.
tio
uti ts
rib en
on
ist um
r D str Figure 6-6. TDMS Reader Block Diagram
10. Set the attributes and time stamp properties of the waveform graph.
❑ On the front panel, right-click the Channel Data graph and select
t fo l In
Ignore Attributes.
Note You must ignore the attributes of the waveform, otherwise the waveform name
attribute would overwrite the labels you set. This option is available only after you wire
a waveform to the graph.
No na
Test
1. Read and display the time domain data.
❑ On the VI front panel, ensure that the default TDMS File Path
tio
matches Table 6-2 and the Data Set is set to Time Data.
Note A001 was one of the serial numbers you entered when you ran the TDMS Logger VI.
Na
❑ Run the VI. A sine wave should display in the Channel Data graph.
❑ Run the VI. Power spectrum data should display in the Channel Data
uti ts
graph.
rib en
TDM Excel Add-In (Optional)
on
Note This exercise requires Microsoft Excel version 2003 or 2007 and the TDM Add-in
Tool available on ni.com.
ist um
1. Launch Microsoft Excel.
2. Click the Add-Ins tab and select the TDM Importer : Import a
r D str TDM(S) File icon in the Custom Toolbars section.
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
Exercise 7-1 Concept: Refactoring a VI
rib en
Goal
on
Improve an existing VI that is poorly designed.
ist um
Description
You receive a VI that is used as a subVI in a larger project. You must
improve the VI for readability and user friendliness.
❑ Run this VI with a variety of input values and observe the varying
t fo l In
warning text.
2. Use the following list to evaluate the VI. Place a checkmark for all issues
that apply.
❑ Unnecessary logic
❑ Duplicated logic
❑ Complicated algorithms
uti ts
rib en
on
ist um
Figure 7-1. Poorly Designed Block Diagram
r D str Improve the VI
Improve the VI in stages. Begin with the first checkmark: The block
diagram is too disorganized.
1. Use the following tips to help you organize the block diagram:
t fo l In
No na
tio
Na
❑ Rearrange wires so that no input wires are running from right to left.
uti ts
❑ Do not allow wires to run under objects.
rib en
2. After the block diagram is better organized, rename controls and
indicators using names that are more descriptive.
on
• The purpose of this VI is to determine whether the current
temperature and wind speed are at a level requiring a warning to
ist um
generate. The VI also lights an LED if a warning occurs.
Figure 7-3 shows the last few functions in the block diagram.
t fo l In
No na
tio
uti ts
rib en
on
ist um
Figure 7-4. Unnecessary Logic Simplified
Notice you can reduce unnecessary logic even further by removing the
Not Equal? function and inverting the Boolean input of the Select
r D str function, as shown in Figure 7-5.
t fo l In
No na
Refer to Figure 7-6 for assistance with wiring this duplicated function
that occurs near the end of the VI.
tio
❑ Wire the input of the Not function to the input wire of the Select
Na
function.
uti ts
rib en
on
ist um
Figure 7-6. Well-Named Controls and Unnecessary Logic Removed
objects.
Note If the subVI is dimmed, right-click the subVI icon on the block diagram and select
Relink to SubVI from the shortcut menu.
❑ Delete the duplicated logic in other locations and replace with the
uti ts
new subVI.
rib en
2. Remove unnecessary local variables and wire to the appropriate control
or indicator instead.
on
ist um
r D str
t fo l In
Figure 7-8. Duplicated Logic Placed in a SubVI and Local Variables Removed
uti ts
An example solution is shown in Figure 7-9 using a state machine. The states
contained are: Heatstroke, Freeze, High Wind, and Generate Warning. You
can explore alternate solutions in the <Solutions>\LabVIEW Core 2\
rib en
Exercise 7-1 Challenge directory.
on
ist um
r D str
t fo l In
No na
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
Exercise 8-1 Preparing Files for Distribution
rib en
Goal
on
Review the Building Applications Checklist and prepare VIs to build a
standalone application.
ist um
Scenario
Review the Building Applications Checklist to assist you in the build
process before creating a standalone application or installer.
r D str Stand-alone applications in LabVIEW have the Window Appearance set to
Top-level application to enable the front panel to open when the VI runs.
Design
• Modify the VI Properties to prepare to build a stand-alone application.
tio
• Modify the application to call the Quit LabVIEW function when the
code is executed in the run-time system.
Implementation
Before you build an application, you first prepare the code so that it executes
reliably when compiled into an application.
uti ts
Review the Building Applications Checklist
1. Select Help»LabVIEW Help to open the LabVIEW Help.
rib en
2. Select Fundamentals»Building and Distributing Applications»
Building Applications Checklist.
on
3. Review the Preparing Files checklist items.
ist um
Set Top-Level Application Window
Note If you have hardware installed and you have not already set up your hardware as
part of a LabVIEW Core 1 exercise, refer to Appendix A, Setting Up Your Hardware.
r D strNote If you do not have hardware installed, use the files located in the <Exercises>\
LabVIEW Core 2\Weather Station\No Hardware Required Version
directory.
t fo l In
1. Open the Weather Station UI VI.
uti ts
rib en
on
ist um
r D str
t fo l In
6. Click OK.
uti ts
rib en
on
Figure 8-2. Adding the Quit LabVIEW Function to the Block Diagram
ist um
❑ Add the Quit LabVIEW function to the block diagram so that it is
the last function that executes. This function quits LabVIEW and
quits the application after it has executed.
– Class: Application
❑ Use the labeling tool to replace the text in the case label with
Run Time System.
tio
Note Enum values that you wire to a case selector terminal are case sensitive.
2. In the Project Explorer window, select File»Save All to save all the VIs.
Na
uti ts
rib en
on
ist um
r D str
t fo l In
No na
❑ From the Project Explorer window, open and run the Weather
Station UI.vi. When you click the Stop button, the VI stops but does
uti ts
not quit LabVIEW.
rib en
file exists and contains the log information.
on
Note If you do not have hardware installed, the weather.txt file is located in the
<Exercises>\LabVIEW Core 2\Weather Station\No Hardware Required
ist um
Version directory.
uti ts
Create a build specification and build a stand-alone application (EXE) in
LabVIEW.
Scenario
rib en
Creating a stand-alone application and an installer simplifies deploying an
on
application on multiple machines. After you have prepared your files, you
create an Application (.exe) Build Specification and then create an
Installer Build Specification.
ist um
Design
Use the Application (EXE) Build Specifications to create a stand-alone
application for the Weather Station application.
r D str Use the Installer Build Specifications to create an installer for the Weather
Station application.
Implementation
t fo l In
Application (EXE) Build Specification
1. Open Weather Station.lvproj in the <Exercises>\
LabVIEW Core 2\Weather Station directory.
3. Modify the filename of the target and destination directory for the
application in the Information category.
Tip You do not need to create the directory. LabVIEW creates any directories that you
specify.
uti ts
❑ Click the right arrow next to the Startup VIs listbox to add the
selected VI to the Startup VIs listbox.
rib en
❑ Click OK.
on
5. In the Project Explorer window, right-click the My Application build
specification that you just created, and select Build from the shortcut
ist um
menu.
8. Verify that the application closed when you stopped the application and
that the weather.txt was created next to the executable.
t fo l In
❑ Click the right arrow next to the Project View tree to place the
uti ts
executable and the executable support files under the Program Files
in the Weather Station directory as shown in Figure 8-4.
rib en
on
ist um
r D str
t fo l In
No na
❑ Click OK.
6. Click Done.
Test
1. Run the setup.exe file in the <Exercises>\LabVIEW Core 2\
Weather Station\Installer\Volume directory. You are guided
through a setup process. The executable is created inside the <Program
uti ts
Files>\Weather Station directory.
rib en
Weather Station.
on
End of Exercise 8-2
ist um
r D str
t fo l In
No na
tio
Na
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
This appendix contains instructions on setting up your hardware.
rib en
Note Complete this setup only if you have hardware installed and have not already
on
completed hardware setup on your system as part of a LabVIEW Core 1 course exercise.
ist um
1. Launch MAX by selecting Start»Programs»National Instruments»
Measurement & Automation or by double-clicking the MAX icon on
your desktop. MAX searches the computer for installed National
Instruments hardware and displays the information.
r D str 2. Create a custom scale for the temperature sensor on the DAQ Signal
Accessory. The sensor conversion is linear and uses the following the
formula Voltage x 100 = Celsius.
t fo l In
No na
tio
Na
❑ Right-click the Scales section and select Create New from the
shortcut menu.
uti ts
❑ Click Next.
❑ Select Linear.
rib en
❑ Name the scale Temperature.
on
❑ Click Finish.
ist um
❑ Change the Scaling Parameter Slope to 100.
r D str ❑ Click the Save button on the toolbar to save the scale.
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
Notes
uti ts
rib en
on
ist um
r D str
t fo l In
No na
tio
Na
uti ts
This appendix contains additional information about National Instruments
rib en
technical support options and LabVIEW resources.
on
Visit the following sections of the award-winning National Instruments
ist um
Web site at ni.com for technical support and professional services:
• Support—Technical support at ni.com/support includes the
following resources:
– Self-Help Technical Resources—For answers and solutions,
visit ni.com/support for software drivers and updates,
r D str a searchable KnowledgeBase, product manuals, step-by-step
troubleshooting wizards, thousands of example programs, tutorials,
application notes, instrument drivers, and so on. Registered
users also receive access to the NI Discussion Forums at ni.com/
t fo l In
forums. NI Applications Engineers make sure every question
submitted online receives an answer.
– Standard Service Program Membership—This program entitles
members to direct access to NI Applications Engineers via phone
and email for one-to-one technical support, as well as exclusive
access to eLearning training modules at ni.com/eLearning.
No na
ni.com/contact.
• System Integration—If you have time constraints, limited in-house
technical resources, or other project challenges, National Instruments
Alliance Partner members can help. The NI Alliance Partners joins
Na
uti ts
areas. Visit ni.com/training to purchase course materials or sign up for
instructor-led, hands-on courses at locations around the world.
rib en
National Instruments Certification
on
Earning an NI certification acknowledges your expertise in working with
NI products and technologies. The measurement and automation industry,
your employer, clients, and peers recognize your NI certification credential
ist um
as a symbol of the skills and knowledge you have gained through
experience. Visit ni.com/training for more information about the
NI certification program.
LabVIEW Resources
r D str This section describes how you can receive more information regarding
LabVIEW.
LabVIEW Publications
t fo l In
LabVIEW Books
Many books have been written about LabVIEW programming and
applications. The National Instruments Web site contains a list of all
the LabVIEW books and links to places to purchase these books.
Visit zone.ni.com/devzone/cda/tut/p/id/5389 for more
No na
information.
tio
Na