My Basket
MECHANICAL DEVICES OF MECHATRONIC SYSTEMS£4.38
vhdl£6.25
DSA£2.50
Total£13.13
Title: LabVIEWTM Basics I Course Manual
Description: This course manual teaches you how to use LabVIEW to develop test
and measurement, data acquisition, instrument control, datalogging,
measurement analysis, and report generation applications
Document Preview
Extracts from the notes are below, to see the PDF you'll receive please use the links above
LabVIEW Basics I
Course Manual
TM
Course Software Version 6
...
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
...
com™, and PXI™ are trademarks of National Instruments Corporation
...
Worldwide Technical Support and Product Information
ni
...
F
...
B
...
D
...
F
...
SG-1
What You Need to Get Started
...
SG-4
Course Goals and Non-Goals
...
SG-6
Course Conventions
...
LabVIEW
...
Virtual Instruments
...
LabVIEW Environment
...
LabVIEW Help Options
...
1-22
Lesson 2
Creating, Editing, and Debugging a VI
A
...
2-2
B
...
2-11
C
...
2-20
Summary, Tips, and Tricks
...
2-29
Lesson 3
Creating a SubVI
A
...
3-2
B
...
3-3
C
...
3-9
D
...
3-16
Summary, Tips, and Tricks
...
3-18
© National Instruments Corporation
iii
LabVIEW Basics I Course Manual
Contents
Lesson 4
Loops and Charts
A
...
4-2
B
...
4-4
C
...
4-17
D
...
4-26
Summary, Tips, and Tricks
...
4-30
Lesson 5
Arrays, Graphs, and Clusters
A
...
5-2
B
...
5-5
C
...
5-7
D
...
5-10
E
...
5-13
F
...
5-30
G
...
5-36
Summary, Tips, and Tricks
...
5-47
Lesson 6
Case and Sequence Structures
A
...
6-2
B
...
6-11
C
...
6-16
D
...
6-20
Summary, Tips, and Tricks
...
6-23
Lesson 7
Strings and File I/O
A
...
7-2
B
...
7-4
C
...
7-11
D
...
7-21
E
...
7-26
Summary, Tips, and Tricks
...
7-37
LabVIEW Basics I Course Manual
iv
ni
...
Overview and Configuration
...
Data Acquisition VI Organization
...
Performing a Single Analog Input
...
The DAQ Wizards
...
Waveform Analog Input
...
Writing Waveform Data to File
...
Scanning Multiple Analog Input Channels
...
Analog Output
...
Digital Input and Output
...
Buffered Data Acquisition (Optional)
...
8-56
Additional Exercise
...
Instrument Control Overview
...
GPIB Communication and Configuration
...
Instrument Driver Overview
...
Using Instrument Driver VIs
...
VISA Overview
...
Using VISA Functions and VIs
...
Serial Port Communication
...
Waveform Transfers (Optional)
...
9-49
Additional Exercises
...
Customizing VI Properties
...
Creating Pop-Up Panels
...
Key Navigation
...
Editing VIs with Difficult VI Setup Options (Optional)
...
Customizing Palettes (Optional)
...
10-27
Appendix
A
...
C
...
Additional Information
...
A-4
VI Quick Reference
...
A-13
© National Instruments Corporation
v
LabVIEW Basics I Course Manual
Student Guide
Thank you for purchasing the LabVIEW Basics I course kit
...
This course manual and the accompanying software are used in the
three-day, hands-on LabVIEW Basics I course
...
Visit the Customer
Education section of ni
...
A
...
This course
manual assumes that you are familiar with Windows, Macintosh, or UNIX
and that you have experience writing algorithms in the form of flowcharts
or block diagrams
...
Each lesson consists of the following:
•
An introduction that describes the purpose of the lesson and what you
will learn
•
A description of the topics in the lesson
•
A set of exercises to reinforce those topics
•
A set of additional exercises to complete if time permits
•
A summary that outlines important concepts and skills taught in the
lesson
© National Instruments Corporation
SG-1
LabVIEW Basics I Course Manual
Student Guide
Several exercises in this manual use one of the following National
Instruments hardware products:
•
A plug-in multifunction data acquisition (DAQ) device connected to a
DAQ Signal Accessory containing a temperature sensor, function
generator, and LEDs
•
A GPIB interface connected to an NI Instrument Simulator
If you do not have this hardware, you still can complete most of the
exercises
...
Exercises that explicitly require hardware are indicated
with an icon, shown at left
...
For example, you can use a GPIB instrument in place
of the NI Instrument Simulator, or another National Instruments DAQ
device connected to a signal source, such as a function generator
...
After each block
diagram picture is a description of each object in the block diagram
...
com
Student Guide
B
...
6
...
5 or later and XWindows system software, an HP 9000
workstation model 700 series HP-UX running 10
...
0
...
0 or later
❑ A serial cable
❑ A GPIB cable
❑ (Optional) A word processing application such as (Windows) Notepad,
WordPad, (Macintosh) TeachText, (UNIX) Text Editor, vi, or vuepad
❑ LabVIEW Basics I course disks, containing the following files
...
llb
VI library containing subVIs used during the course
nidevsim
...
exe
© National Instruments Corporation
Self-extracting archive containing the solutions to all
the course exercises
SG-3
LabVIEW Basics I Course Manual
Student Guide
Class exercises that use the Thermometer VI use the (Demo) Thermometer VI in
the solutions
...
llb
...
Installing the Course Software
Complete the following steps to install the LabVIEW Basics I course
software
...
Copy the basics1
...
lib directory
...
2
...
zip to the labview\instr
...
After you start LabVIEW, the NI DevSim instrument driver is
located on the Functions»Instrument I/O»Instrument Drivers
palette
...
Copy the LV Basics I directory to the c:\exercises directory
...
(Optional) Double-click bas1soln
...
Macintosh
1
...
llb file from course disk 1 to the user
...
After you start LabVIEW, the contents of this
directory are located on the Functions»User Libraries palette
...
On a Windows computer, unzip the contents of the nidevsim
...
Copy the resulting directory to the labview:instrlib directory
...
3
...
4
...
exe and copy them to your hard drive to an appropriate
folder to install the solutions to all exercises
...
Log in as a superuser
...
Make sure the course disks are not write protected
...
Mount course disk 1 and copy the basics1
...
lib directory
...
LabVIEW Basics I Course Manual
SG-4
ni
...
On a Windows computer, unzip the contents of the nidevsim
...
Copy the resulting directory to the /labview/instrlib directory
...
5
...
6
...
exe and copy them to your hard drive to an appropriate
directory to install the solutions to all exercises
...
After you copy the files, use the chown command to change the owner
of each file from root to the current user
...
Course Goals and Non-Goals
This course prepares you to do the following:
•
Use LabVIEW to create applications
...
•
Understand front panels, block diagrams, and icons and connector
panes
...
•
Create and save VIs so you can use them as subVIs
...
•
Create applications that use plug-in DAQ devices
...
Course Map
Introduction to
LabVIEW
Creating, Editing,
and Debugging a VI
Creating a SubVI
Loops and Charts
Arrays, Graphs,
and Clusters
Case and Sequence
Structures
Strings and
File I/O
Data Acquisition
and Waveforms
Instrument
Control
VI Customization
LabVIEW Basics I Course Manual
SG-6
ni
...
Course Conventions
The following conventions appear in this course manual:
»
The » symbol leads you through nested menu items and dialog box options
to a final action
...
This icon denotes a tip, which alerts you to advisory information
...
This icon indicates that an exercise requires a plug-in GPIB interface or
DAQ device
...
Bold text also denotes parameter names,
controls and buttons on the front panel, dialog boxes, sections of dialog
boxes, menu names, and palette names
...
This font also denotes text that is a placeholder for a word
or value that you must supply
...
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, and code excerpts
...
right-click
(Macintosh) Press
-click to perform the same action as a right-click
...
You Will Learn: A
...
What a virtual instrument (VI) is C
...
About the LabVIEW help options © National Instruments Corporation 1-1 LabVIEW Basics I Course Manual Lesson 1 Introduction to LabVIEW A
...
In contrast to text-based programming languages, where instructions determine program execution, LabVIEW uses dataflow programming, where the flow of data determines execution
...
The user interface is known as the front panel
...
The block diagram contains this code
...
LabVIEW is integrated fully for communication with hardware such as GPIB, VXI, PXI, RS-232, RS-485, and plug-in DAQ devices
...
Using LabVIEW, you can create test and measurement, data acquisition, instrument control, datalogging, measurement analysis, and report generation applications
...
LabVIEW Basics I Course Manual 1-2 ni
...
Virtual Instruments LabVIEW programs are called virtual instruments (VIs)
...
The front panel is the user interface of the VI
...
You build the front panel with controls and indicators, which are the interactive input and output terminals of the VI, respectively
...
Indicators are graphs, LEDs, and other displays
...
Indicators simulate instrument output devices and display data the block diagram acquires or generates
...
The block diagram contains this graphical source code
...
You cannot delete a terminal from the block diagram
...
Block diagram objects include terminals, subVIs, functions, constants, structures, and wires, which transfer data among other block diagram objects
...
After you build a front panel and block diagram, build the icon and the connector pane so you can use it in another VI
...
A subVI corresponds to a subroutine in text-based programming languages
...
An icon is a graphical representation of a VI
...
If you use a VI as a subVI, the icon identifies the subVI on the block diagram of the VI
...
The connector pane is a set of terminals that corresponds to the controls and indicators of that VI, similar to the parameter list of a function call in text-based programming languages
...
A connector pane receives data at its input terminals and passes the data to the block diagram code through the front panel controls and receives the results at its output terminals from the front panel indicators
...
After you create a VI, you can use it as a subVI on the block diagram of a high-level VI
...
Using subVIs helps you manage changes and debug the block diagram quickly
...
com Lesson 1 Introduction to LabVIEW As you create VIs, you might find that you perform a certain operation frequently
...
Refer to Lesson 4, Loops and Charts, for more information about using loops
...
You can create a subVI that performs that operation and call the subVI twice
...
The following example uses the Temperature VI as a subVI on its block diagram
...
LabVIEW Environment When you launch LabVIEW, the following dialog box appears
...
Click the arrow next to the button to create another type of LabVIEW object, such as a control
...
Click the arrow next to the button to open recently opened files
...
• Click the Search Examples button to open a help file that lists and links to all available LabVIEW example VIs
...
Use this tutorial to learn basic LabVIEW concepts
...
(Macintosh) Click the Quit button
...
Click the Next button to view more tips
...
Front Panel and Block Diagram Windows When you click the New VI button, an untitled front panel window appears
...
The other window contains the block diagram
...
LabVIEW Basics I Course Manual 1-6 ni
...
The following toolbar appears on the front panel
...
While the VI runs, the button changes to the following if the VI is a high-level VI
...
This button indicates that the VI is broken and cannot run
...
Click the Run Continuously button to run the VI until you abort or pause it
...
While the VI runs, the Abort Execution button appears
...
Avoid using the Abort Execution button to stop a VI, and either let the VI run to completion or design a method to stop the VI programmatically
...
For example, you can programmatically stop a VI using a switch on the front panel
...
When you click the Pause button, LabVIEW highlights on the block diagram the location where you paused execution
...
Select the Text Settings pull-down menu to change the font settings for the VI, including size, style, and color
...
Select the Distribute Objects pull-down menu to space objects evenly, including gaps, compression, and so on
...
Select one of the objects with the Positioning tool and then select from Move Forward, Move Backward, Move To Front, and Move To Back
...
com Lesson 1 Introduction to LabVIEW Block Diagram Toolbar When you run a VI, buttons appear on the block diagram toolbar that you can use to debug the VI
...
Click the Highlight Execution button to see the flow of data through the block diagram
...
Click the Step Into button to single-step into a loop, subVI, and so on
...
Each node blinks to denote when it is ready to execute
...
Click the Step Over button to step over a loop, subVI, and so on
...
Click the Step Out button to step out of a loop, subVI, and so on
...
The Warning button appears when there is a potential problem with the block diagram, but it does not stop the VI from running
...
Shortcut Menus The most often-used menu is the object shortcut menu
...
Use the shortcut menu items to change the look or behavior of front panel and block diagram objects
...
(Macintosh) Press the key and click the object, front panel, or block diagram
...
Some menu items also list shortcut key combinations
...
© National Instruments Corporation 1-9 LabVIEW Basics I Course Manual Lesson 1 Introduction to LabVIEW Note Some menu items are unavailable while a VI is running
...
• Use the Edit menu to search for and modify components of a VI
...
• Use the Tools menu to communicate with instruments and DAQ devices, compare VIs, build applications, enable the Web Server, and configure LabVIEW
...
• Use the Window menu to display LabVIEW windows and palettes
...
Palettes LabVIEW has graphical, floating palettes to help you create and run VIs
...
You can place these palettes anywhere on the screen
...
The Tools palette is available on the front panel and the block diagram
...
When you select a tool, the cursor icon changes to the tool icon
...
Select Window»Show Tools Palette to display the Tools palette
...
Press the key and right-click to display a temporary version of the Tools palette at the location of the cursor
...
com Lesson 1 Introduction to LabVIEW Use the Operating tool to change the values of a control or select the text within a control
...
Use the Positioning tool to select, move, or resize objects
...
Use the Labeling tool to edit text and create free labels
...
Use the Wiring tool to wire objects together on the block diagram
...
Use the Scrolling tool to scroll through windows without using scrollbars
...
Use the Probe tool to create probes on wires on the block diagram
...
Use the Color Copy tool to copy colors for pasting with the Coloring tool
...
It also displays the current foreground and background color settings
...
When you click a subpalette icon, the entire palette changes to the subpalette you selected
...
Use the navigation buttons on the Controls and Functions palettes to navigate and search for controls, VIs, and functions
...
© National Instruments Corporation 1-11 LabVIEW Basics I Course Manual Lesson 1 Introduction to LabVIEW Controls Palette Use the Controls palette to place controls and indicators on the front panel
...
Select Window»Show Controls Palette or right-click the front panel workspace to display the Controls palette
...
Tack down the Controls palette by clicking the pushpin on the top left corner of the palette
...
The Functions palette is available only on the block diagram
...
You also can display the Functions palette by right-clicking an open area on the block diagram
...
LabVIEW Basics I Course Manual 1-12 ni
...
Loading VIs You load a VI into memory by selecting File»Open
...
The VIs you edit in this course are in c:\exercises\LV Basics I
...
The Loading field lists the subVIs of the VI as they are loaded into memory
...
You can cancel the load at any time by clicking the Stop button
...
The Searching field lists directories or VIs as LabVIEW searches through them
...
Saving VIs Select Save, Save As, Save All, or Save with Options from the File menu to save VIs as individual files or group several VIs together and save them in a VI library
...
llb
...
LabVIEW uses native file dialogs for loading and saving
...
Moving VIs Across Platforms You can transfer VIs from one platform to another, such as from Macintosh to Windows
...
Because VIs are files, you can use any file transfer method or utility to move VIs between platforms
...
Such network transfers eliminate the need for additional file translation software
...
• (Macintosh) DOS Mounter, MacLink, and Apple File Exchange convert PC files to the Macintosh format and vice versa
...
• (HP-UX) The doscp command mounts PC disks and copies their files
...
LabVIEW Basics I Course Manual 1-14 ni
...
1
...
The LabVIEW dialog box appears
...
Click the Search Examples button
...
3
...
The Frequency Response VI front panel appears
...
llb\Frequency Response
...
Front Panel 4
...
This VI simulates sending a stimulus signal to a Unit Under Test (UUT) and then reading back the response
...
5
...
Click the mark on the knob and drag it to the desired location, use the increment or decrement arrows on the digital control, or place the cursor in the digital display and enter a number
...
The number is not passed to the VI until you click this button or press the key
...
© National Instruments Corporation 1-15 LabVIEW Basics I Course Manual Lesson 1 Introduction to LabVIEW 6
...
Try adjusting the other controls on the panel and running the VI to see what changes occur
...
Select Window»Show Diagram or press the keys to display the following block diagram for the Frequency Response VI
...
(Sun) Press the keys
...
This block diagram contains several of the basic block diagram elements, including subVIs, functions, and structures, which you will learn about later in this course
...
Use the Operating tool to double-click the following DMM icon
...
After you double-click it, the following front panel of that subVI opens
...
This is why LabVIEW programs are called virtual instruments
...
com Lesson 1 Introduction to LabVIEW application or reuse those parts in the same or other applications
...
9
...
10
...
End of Exercise 1-1 © National Instruments Corporation 1-17 LabVIEW Basics I Course Manual Lesson 1 Introduction to LabVIEW D
...
Context Help Window To display the Context Help window, select Help»Show Context Help or press the keys
...
(Sun) Press the keys
...
When you move the cursor over front panel and block diagram objects, the Context Help window displays the icon for subVIs, functions, constants, controls and indicators, with wires attached to each terminal
...
In the window, required connections are bold, recommended connections are plain text, and optional connections are dimmed or do not appear
...
Click the Simple/Detailed Context Help button located on the lower left corner of the Context Help window to change between simple and detailed context help
...
Optional terminals are shown by wire stubs, informing you that other connections exist
...
LabVIEW Basics I Course Manual 1-18 ni
...
When the contents are locked, moving the cursor over another object does not change the contents of the window
...
You also can access this option from the Help menu
...
LabVIEW Help The LabVIEW Help contains detailed descriptions of most palettes, menus, tools, VIs, and functions
...
You can access this information either by clicking the More Help button in the Context Help window, selecting Help»Contents and Index, or clicking the sentence Click here for more help in the Context Help window
...
Part A 1
...
2
...
a
...
b
...
The Technical Support Resources topic appears
...
Click the Technical Support link to open the Technical Support section of ni
...
d
...
3
...
a
...
The Related Documentation topic appears
...
Click the LabVIEW User Manual link to open the PDF version of the manual in the LabVIEW Help window
...
Click the Help Topics button on the toolbar to hide the Contents tab of the LabVIEW Help window
...
Click the Help Topics button again to display the Contents tab
...
Click the Back button to return to the Related Documentation topic
...
Browse through a few of the other sections of the LabVIEW Help
...
The Frequency Response VI should still be open from Exercise 1-1
...
6
...
7
...
(Macintosh) Press the keys
...
(HP-UX and Linux) Press the keys
...
com Lesson 1 Introduction to LabVIEW 8
...
a
...
A description of the function appears in the Context Help window
...
Try displaying the help for other functions
...
Move the Wiring tool, shown at left, over the terminals of the Logarithm Base 10 function
...
c
...
The Context Help window displays the data type of the wire
...
In the front panel window, select File»Close to close the Frequency Response VI
...
End of Exercise 1-2 © National Instruments Corporation 1-21 LabVIEW Basics I Course Manual Lesson 1 Introduction to LabVIEW Summary, Tips, and Tricks • Virtual instruments (VIs) contain three main components—the front panel, the block diagram, and the icon and connector pane
...
• The block diagram contains the graphical source code composed of nodes, terminals, and wires
...
Press the key and right-click to display a temporary version of the Tools palette at the location of the cursor
...
Right-click an open area on the front panel to display the Controls palette
...
Right-click an open area on the block diagram to display the Functions palette
...
(Macintosh) Access shortcut menus by pressing the key while you click an object, the front panel, or the block diagram
...
1-22 ni
...
com Lesson 2 Creating, Editing, and Debugging a VI This lesson introduces the basics of creating a VI
...
How to create VIs B
...
Debugging techniques © National Instruments Corporation 2-1 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI A
...
Refer to Lesson 3, Creating a SubVI, for more information about the icon and connector pane
...
Controls are knobs, push buttons, dials, and other input devices
...
Controls simulate instrument input devices and supply data to the block diagram of the VI
...
Use the Controls palette to place controls and indicators on the front panel
...
Select Window»Show Controls Palette or right-click the front panel workspace to display the Controls palette
...
2 1 3 1 Increment arrow buttons 2 Digital control 3 Digital indicator To enter or change values in a digital control, you can click the increment arrow buttons with the Operating tool or double-click the number with either the Labeling tool or the Operating tool, type a new number, and press the key
...
Boolean Controls and Indicators Use Boolean controls and indicators to enter and display Boolean (TRUE or FALSE) values
...
The most common Boolean objects are the vertical toggle switch and the round LED, as shown in the following illustration
...
com Lesson 2 Creating, Editing, and Debugging a VI Configuring Controls and Indicators You can configure nearly all controls and indicators using their shortcut menus
...
For example, to configure a label, right-click the label
...
Block Diagram The block diagram is composed of nodes, terminals, and wires, as shown in the following illustration
...
They are analogous to statements, operators, functions, and subroutines in text-based programming languages
...
Functions are built-in execution elements, comparable to an operator, function, or statement
...
Structures are process control elements, such as Sequence structures, Case structures, For Loops, or While Loops
...
© National Instruments Corporation 2-3 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI Terminals Front panel objects appear as terminals on the block diagram
...
For example, a DBL terminal, shown at left, represents a double-precision, floating-point numeric control or indicator
...
Terminals are analogous to parameters and constants in text-based programming languages
...
Control and indicator terminals belong to front panel controls and indicators
...
The data then enter the Add and Subtract functions
...
The data flow to the indicator terminals, where they exit the block diagram, reenter the front panel, and appear in front panel indicators
...
The connector panes of the Add and Subtract functions, shown at left, have three node terminals
...
Wires You transfer data among block diagram objects through wires
...
Each wire has a single data source, but you can wire it to many VIs and functions that read the data
...
The following examples are the most common wire types
...
You also can automatically wire objects already on the block diagram
...
LabVIEW Basics I Course Manual 2-4 ni
...
When you release the mouse button to place the object on the block diagram, LabVIEW automatically connects the wires
...
You can adjust the automatic wiring settings by selecting Tools»Options and selecting Block Diagram from the top pull-down menu
...
To return to the icon, right-click the function node and select Visible Items»Terminals from the shortcut menu to remove the checkmark
...
A block diagram node executes when all its inputs are available
...
Visual Basic, C++, JAVA, and most other text-based programming languages follow a control flow model of program execution
...
For example, consider a block diagram that adds two numbers and then subtracts 50
...
In this case, the block diagram executes from left to right, not because the objects are placed in that order, but because one of the inputs of the Subtract function is not valid until the Add function has finished executing and passed the data to the Subtract function
...
© National Instruments Corporation 2-5 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI In the following example, consider which code segment would execute first—the Add, Random Number, or Divide function
...
In a situation where one code segment must execute before another, and no data dependency exists between the functions, use a Sequence structure to force the order of execution
...
Searching for Controls, VIs, and Functions Use the following navigation buttons on the Controls and Functions palettes to navigate and search for controls, VIs, and functions: • Up—Takes you up one level in the palette hierarchy
...
In search mode, you can perform text-based searches to locate controls, VIs, or functions in the palettes
...
For example, if you want to find the Random Number function, click the Search button on the Functions palette toolbar and start typing Random Number in the textbox at the top of the palette
...
You can click one of the search results and drag it to the block diagram, as shown in the following example
...
com Lesson 2 Creating, Editing, and Debugging a VI Double-click the search result to highlight its location on the palette
...
© National Instruments Corporation 2-7 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI Exercise 2-1 Objective: Convert C to F VI To build a VI
...
1 In wiring illustrations, the arrow at the end of this mouse icon shows where to click and the number on the arrow indicates how many times to click
...
Select File»New to open a new front panel
...
2
...
3
...
You will use this control to enter the value for degrees Centigrade
...
Select the digital control on the Controls»Numeric palette
...
b
...
c
...
If you do not type the name immediately, LabVIEW uses a default label
...
4
...
You will use this indicator to display the value for degrees Fahrenheit
...
Select the digital indicator on the Controls»Numeric palette
...
Move the indicator to the front panel and click to place the indicator
...
Type deg F inside the label and click outside the label or click the Enter button
...
The terminals represent the data type of the control or indicator
...
Note Control terminals have a thicker border than indicator terminals
...
com Lesson 2 Creating, Editing, and Debugging a VI Block Diagram 5
...
6
...
If the Functions palette is not visible, right-click an open area on the block diagram to display it
...
Select the numeric constant on the Functions»Numeric palette and place two of them on the block diagram
...
8
...
8 in one constant and 32
...
If you moved the constants before you typed a value, use the Labeling tool to enter the values
...
Use the Wiring tool, shown at left, to wire the icons as shown in the previous block diagram
...
You can start wiring at either terminal
...
Press the spacebar to toggle the wire direction
...
Return to the icons after wiring by right-clicking the functions and selecting Visible Items»Terminals from the shortcut menu to remove the checkmark
...
• To cancel a wire you started, press the key, right-click, or click the source terminal
...
Display the front panel by clicking it or by selecting Window»Show Panel
...
Save the VI, because you will use this VI later in the course
...
Select File»Save
...
Navigate to c:\exercises\LV Basics I
...
c
...
vi in the dialog box
...
Click the Save button
...
Enter a number in the digital control and run the VI
...
Use the Operating tool, shown at left, or the Labeling tool to double-click the digital control and type a new number
...
Click the Run button, shown at left, to run the VI
...
Try several different numbers and run the VI again
...
Select File»Close to close the Convert C to F VI
...
com Lesson 2 Creating, Editing, and Debugging a VI B
...
You cannot delete a control or indicator terminal from the block diagram
...
Selecting Objects Use the Positioning tool to click an object to select it on the front panel and block diagram
...
To select more than one object, press the key while you click each additional object you want to select
...
Moving Objects You can move an object by clicking it with the Positioning tool and dragging it to a desired location
...
Press the key while you press the arrow keys to move objects several pixels at a time
...
The direction you initially move determines whether the object is limited to horizontal or vertical movement
...
Undo/Redo If you make a mistake while editing a VI, you can undo or redo those steps by selecting Undo or Redo from the Edit menu
...
© National Instruments Corporation 2-11 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI Duplicating Objects You can duplicate most objects by pressing the key while using the Positioning tool to click and drag a selection
...
(Sun) Press the key
...
(HP-UX) You also can duplicate objects by clicking and dragging the object with the middle mouse button
...
This process is called cloning
...
Labeling Objects Use labels to identify objects on the front panel and block diagram
...
Owned labels belong to and move with a particular object and annotate that object only
...
Free labels are not attached to any object, and you can create, move, rotate, or delete them independently
...
To create a free label, use the Labeling tool to click any open area and type the text you want to appear in the label in the box that appears
...
By default, pressing the key adds a new line
...
To end text entry with the key, select Tools»Options, select Front Panel from the top pull-down menu, and place a checkmark in the End text entry with Return key checkbox
...
Selecting and Deleting Wires A wire segment is a single horizontal or vertical piece of wire
...
The point at which three or four wire segments join is a junction
...
To select a wire segment, use the Positioning tool to click the wire
...
LabVIEW Basics I Course Manual 2-12 ni
...
1 2 3 Broken Wires A broken wire appears as a dashed black line, as shown in the following example
...
1 2 1 © National Instruments Corporation Dashed wire (broken) 2 2-13 Solid wire (good) LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI Move the Wiring tool over a broken wire to view the tip strip that describes why the wire is broken
...
You can remove all broken wires by selecting Edit»Remove Broken Wires
...
Sometimes a wire appears broken because you are not finished wiring the block diagram
...
Certain controls and indicators use text in more than one display
...
You can modify each text display independently by using the Labeling tool to highlight the text, as shown in the following graph
...
Resizing Objects You can change the size of most front panel objects
...
When you resize an object, the font size remains the same
...
Press the key while you drag the resizing handles or circles to keep the object proportional to its original size
...
LabVIEW Basics I Course Manual 2-14 ni
...
To space objects evenly, select the objects and select the Distribute Objects pull-down menu on the toolbar
...
You also can copy pictures or text from other applications and paste them on the front panel or block diagram
...
Coloring Objects You can change the color of many objects but not all of them
...
Use the Coloring tool and right-click an object or workspace to add or change the color of front panel objects or the front panel and block diagram workspaces
...
You also can make front panel objects transparent to layer them
...
© National Instruments Corporation 2-15 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI Exercise 2-2 Objective: Editing Exercise VI To edit a VI
...
Note Remember that you can select Edit»Undo if you make a mistake
...
Select File»Open and navigate to c:\exercises\LV Basics I to open the Editing Exercise VI
...
2
...
a
...
The control label follows the position of the control
...
Click a blank space on the front panel to deselect the control
...
Click the label and drag it to another location
...
You can position an owned label anywhere relative to the control
...
LabVIEW Basics I Course Manual 2-16 ni
...
Reposition the three slide switches as a group
...
Use the Positioning tool to click an open area near the three switches and drag a selection rectangle around the switches
...
Click and drag one of the selected switches to a different location
...
4
...
a
...
b
...
c
...
5
...
a
...
Resizing circles appear on the LED
...
Click and drag the cursor to enlarge the LED
...
6
...
a
...
Use the Operating tool, shown at left, to click the LED and change its state to ON and bright green (TRUE)
...
Use the Coloring tool, shown at left, to right-click the LED and display the color picker
...
Select a red color to change the ON state to red
...
Display and edit the owned label of the digital indicator
...
Use the Labeling tool, shown at left, to right-click the digital indicator and select Visible Items»Label from the shortcut menu
...
b
...
c
...
8
...
a
...
b
...
© National Instruments Corporation 2-17 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI 9
...
a
...
(Macintosh) Press the key
...
(HP-UX and Linux) Press the key
...
Drag the copy to a new location
...
Change the text characteristics and hide the box around the free label
...
Use the Positioning tool to select the free label
...
Select the Text Settings pull-down menu on the toolbar, shown at left, and change the text characteristics
...
Use the Coloring tool to right-click the label and select T from the color picker
...
Change the text characteristics and color of the y-axis text
...
Use the Labeling tool to highlight 10
...
b
...
12
...
0 and type -10
...
Block Diagram 13
...
Wire the block diagram terminals as shown in the following block diagram
...
00, by the value in the digital control
...
00, and passes it to the waveform graph
...
com Lesson 2 Creating, Editing, and Debugging a VI The Not function inverts the value of the Boolean switch A and passes the value to the round LED
...
Right-click the lower left terminal of the Multiply function and select Create»Constant from the shortcut menu to create a numeric constant, shown at left
...
Type 5 in the textbox and click the Enter button on the toolbar
...
Use the Wiring tool, shown at left, and the following techniques to wire the block diagram: • Select Help»Show Context Help to display the Context Help window
...
Required terminals are bold, recommended connections are plain text, and optional connections are gray
...
When wiring is complete, right-click the connector pane and select Visible Items»Terminal from the shortcut menu to remove the checkmark
...
• To cancel a wire you started, press the key, right-click, or click the source terminal
...
Select File»Save to save the VI
...
Display the front panel by clicking it or by selecting Window»Show Panel
...
Use the Operating tool to change the value of the front panel controls
...
Click the Run button on the toolbar to run the VI
...
Select File»Close to close the VI
...
Debugging Techniques If a VI does not run, it is a broken, or nonexecutable, VI
...
If it is still broken when you finish wiring the block diagram, the VI is broken and will not run
...
Double-click an error description to display the relevant block diagram or front panel and highlight the object that contains the error
...
Execution highlighting shows the movement of data on the block diagram from one node to another using bubbles that move along the wires
...
Note Execution highlighting greatly reduces the speed at which the VI runs
...
The single-stepping buttons affect execution only in a VI or subVI in single-step mode
...
Move the cursor over the Step Over, Step Into, or Step Out button to view a tip strip that describes the next step if you click that button
...
If you single-step through a VI with execution highlighting on, an execution glyph, shown at left, appears on the icons of the subVIs that are currently running
...
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
...
For example, if you are viewing numeric data, you can choose to see that data in a chart within the probe
...
LabVIEW Basics I Course Manual 2-20 ni
...
When you set a breakpoint on a wire, execution pauses after data pass through the wire
...
Breakpoints are red frames for nodes and block diagrams and red dots for wires
...
Complete the following steps to load a broken VI and correct the error and to use single-stepping and execution highlighting to step through the VI
...
Select File»Open and navigate to c:\exercises\LV Basics I to open the Debug Exercise (Main) VI
...
The following front panel appears
...
2
...
The Random Number (0-1) function produces a random number between 0 and 1
...
0
...
The Debug Exercise (Sub) VI adds 100
...
3
...
a
...
The Error list window that appears lists all the errors
...
Click each error description for more information about the error
...
Click the Show Error button to display the relevant block diagram or front panel and highlight the object that contains the error
...
Use the information in the Details section to fix each error
...
Select File»Save to save the VI
...
com Lesson 2 Creating, Editing, and Debugging a VI 5
...
6
...
7
...
8
...
a
...
b
...
Execution highlighting shows the movement of data on the block diagram from one node to another using bubbles that move along the wires
...
c
...
Each time you click the Step Over button, the current node executes and pauses at the next node, which is ready to execute
...
The VI generates a random number and multiplies it by 10
...
The subVI adds 100
...
d
...
9
...
a
...
b
...
The following block diagram appears
...
Display the Debug Exercise (Main) VI block diagram by clicking it
...
d
...
e
...
The Debug Exercise (Main) VI block diagram is active
...
Click the Step Out button to stop single-stepping
...
Use a probe to view data as it flows through a wire
...
Use the Probe tool, shown at left, to click any object
...
The number in the titlebar of the Probe window matches the number on the block diagram where you placed the probe
...
Single-step through the VI again
...
11
...
a
...
Clicking the block diagram workspace is analogous to a break on the first line
...
Click the Run button to run the VI
...
c
...
d
...
12
...
13
...
End of Exercise 2-3 LabVIEW Basics I Course Manual 2-24 ni
...
• Control terminals have a thicker border than indicator terminals
...
• The block diagram is composed of nodes, terminals, and wires
...
Use the Positioning tool to select, move, and resize objects
...
• Use the Search button on the Controls and Functions palettes to search for controls, VIs, and functions
...
Click the broken Run button to display the Error list window, which lists all the errors
...
Tips & Tricks Most of the following tips and tricks instruct you to press the key
...
(Sun) Press the key
...
Operating • Frequently used menu options have equivalent keyboard shortcuts
...
Common keyboard shortcuts include the following: Toggles between the front panel and block diagram
...
Removes all broken wires
...
Finds VIs, globals, functions, text, or other objects loaded in memory or in a specified list of VIs
...
To toggle between the Positioning and Wiring tools on the block diagram or the Positioning and Operating tools on the front panel, press the spacebar
...
• You can disable the debugging tools to reduce memory requirements and to increase performance slightly
...
Editing • Use the following shortcuts to create constants, controls, and indicators: – Right-click a function terminal and select Create»Constant, Create»Control, or Create»Indicator from the shortcut menu
...
– Drag constants from the block diagram to the front panel to create a control
...
• To keep an object proportional to its original size as you resize it, press the key while you drag the resizing handles or circles
...
• To replace nodes, right-click the node and select Replace from the shortcut menu
...
• To display the front panel of a subVI from the calling VI, use the Operating or Positioning tool to double-click the subVI on the block diagram
...
• LabVIEW Basics I Course Manual To duplicate an object, press the key while using the Positioning tool to click and drag a selection
...
2-26 ni
...
Pressing accepts the item and positions the cursor to add the next item
...
Use the Coloring tool to click the object to which you want to apply the color
...
• Select Edit»Undo if you make a mistake
...
Wiring • Select Help»Show Context Help to display the Context Help window
...
Required terminals are bold, recommended connections are plain text, and optional connections are gray
...
• You can bend a wire by clicking to tack the wire down and moving the cursor in a perpendicular direction
...
1 2 1 1 2 Tack down a wire by clicking 2 Tack and break the wire by double-clicking • To show dots at wire junctions on the block diagram, select Tools»Options and select Block Diagram from the top pull-down menu
...
To move objects several pixels, press the key while you press the arrow keys
...
© National Instruments Corporation 2-27 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI • Use the tip strips that appear as you move the Wiring tool over terminals
...
Debugging • When single-stepping, use the following keyboard shortcuts: Steps over a node
...
Steps out of a node
...
com Lesson 2 Creating, Editing, and Debugging a VI Additional Exercises 2-4 Build a VI that compares two numbers and turns on an LED if the first number is greater than or equal to the second number
...
vi
...
2-5 Build a VI that generates a random number between 0
...
0 and divides the random number by a number specified on the front panel
...
Save the VI and name it Divide
...
© National Instruments Corporation 2-29 LabVIEW Basics I Course Manual Lesson 2 Creating, Editing, and Debugging a VI Notes LabVIEW Basics I Course Manual 2-30 ni
...
You Will Learn: A
...
How to create an icon and connector pane C
...
How to create subVIs from sections of another VI © National Instruments Corporation 3-1 LabVIEW Basics I Course Manual Lesson 3 Creating a SubVI A
...
A VI within another VI is called a subVI
...
A subVI node corresponds to a subroutine call in text-based programming languages
...
Using subVIs helps you manage changes and debug the block diagram quickly
...
The following pseudo-code and block diagrams demonstrate the analogy between subVIs and subroutines
...
0; main { average (point1, point2, pointavg) } } SubVI Block Diagram LabVIEW Basics I Course Manual 3-2 Calling VI Block Diagram ni
...
Icon and Connector Pane After you build a VI front panel and block diagram, build the icon and the connector pane so you can use the VI as a subVI
...
An icon is a graphical representation of a VI
...
If you use a VI as a subVI, the icon identifies the subVI on the block diagram of the VI
...
Create custom icons to replace the default icon by right-clicking the icon in the upper right corner of the front panel or block diagram and selecting Edit Icon from the shortcut menu or by double-clicking the icon in the upper right corner of the front panel
...
Use the tools on the left side of the Icon Editor dialog box to create the icon design in the editing area
...
You also can drag a graphic from anywhere in your file system and drop it in the upper right corner of the front panel or block diagram
...
LabVIEW uses the monochrome icon for printing unless you have a color printer
...
Select the Copy from options to change modes
...
Use the Line tool to draw straight lines
...
Use the Color Copy tool to copy the foreground color from an element in the icon
...
Use the Rectangle tool to draw a rectangular border in the foreground color
...
Use the Filled Rectangle tool to draw a rectangle with a foreground color frame and filled with the background color
...
Use the Select tool to select an area of the icon to cut, copy, move, or make other changes
...
Use the Text tool to enter text into the icon
...
(Windows) Small Fonts works well in icons
...
Click each rectangle to display a color palette from which you can select new colors
...
Setting up the Connector Pane To use a VI as a subVI, you need to build a connector pane, shown at left
...
com Lesson 3 Creating a SubVI text-based programming languages
...
Define connections by assigning a front panel control or indicator to each of the connector pane terminals
...
The connector pane replaces the icon
...
Use the rectangles to assign inputs and outputs
...
The following front panel has four controls and one indicator, so LabVIEW displays four input terminals and one output terminal on the connector pane
...
Select a connector pane pattern with extra terminals
...
This flexibility enables you to make changes with minimal effect on the hierarchy of the VIs
...
A solid border highlights the pattern currently associated with the icon
...
Try not to assign more than 16 terminals to a VI
...
Note To change the spatial arrangement of the connector pane patterns, right-click the connector pane and select Flip Horizontal, Flip Vertical, or Rotate 90 Degrees from the shortcut menu
...
When you link controls and indicators to the connector pane, place inputs on the left and outputs on the right to prevent complicated, unclear wiring patterns in your VIs
...
Click the front panel control or indicator you want to assign to the terminal
...
The terminal changes to the data type color of the control to indicate that you connected the terminal
...
Although you use the Wiring tool to assign terminals on the connector pane to front panel controls and indicators, no wires are drawn between the connector pane and these controls and indicators
...
com Lesson 3 Exercise 3-1 Objective: Creating a SubVI Convert C to F VI To create an icon and a connector pane so you can use a VI as a subVI
...
Front Panel 1
...
(Windows, Sun, and HP-UX) If you closed all open VIs, click the Open VI button on the LabVIEW dialog box
...
2
...
The Icon Editor dialog box appears
...
Double-click the Select tool, shown at left, on the left side of the Icon Editor dialog box to select the default icon
...
Press the key to remove the default icon
...
Double-click the Rectangle tool, shown at left, to redraw the border
...
Create the following icon
...
Use the Text tool, shown at left, to click the editing area
...
Type C and F
...
Double-click the Text tool and change the font to Small Fonts
...
Use the Pencil tool, shown at left, to create the arrow
...
Note e
...
f
...
g
...
The icon appears in the icon in the upper right corner of the front panel and block diagram
...
Right-click the icon on the front panel and select Show Connector from the shortcut menu to define the connector pane terminal pattern
...
For example, this front panel has two terminals, deg C and deg F, so LabVIEW selects a connector pane pattern with two terminals, shown at left
...
Assign the terminals to the digital control and digital indicator
...
Select Help»Show Context Help to display the Context Help window
...
b
...
The tool automatically changes to the Wiring tool, and the terminal turns black
...
Click the deg C control
...
d
...
The marquee disappears and the terminal changes to the data type color of the control to indicate that you connected the terminal
...
Click the right terminal in the connector pane and click the deg F indicator
...
f
...
Both terminals are orange
...
Move the cursor over the connector pane
...
9
...
10
...
End of Exercise 3-1 LabVIEW Basics I Course Manual 3-8 ni
...
Using SubVIs After you build a VI and create its icon and connector pane, you can use it as a subVI
...
Navigate to and double-click the VI you want to use as a subVI and place it on the block diagram
...
Opening and Editing SubVIs To display the front panel of a subVI from the calling VI, use the Operating or Positioning tool to double-click the subVI on the block diagram
...
To display the block diagram of a subVI from the calling VI, press the key and use the Operating or Positioning tool to double-click the subVI on the block diagram
...
(Sun) Press the key
...
Any changes you make to a subVI affect only the current instance of the subVI until you save the subVI
...
Setting Required, Recommended, and Optional Inputs and Outputs In the Context Help window, which you can access by selecting Help»Show Context Help, required connections are bold, recommended connections are plain text, and optional connections are dimmed if you have the Detailed view selected or do not appear if you have the Simple view selected
...
Right-click a terminal in the connector pane and select This Connection Is from the shortcut menu
...
Select Required, Recommended, or Optional
...
When an input or output is recommended, you can run the VI, but LabVIEW reports a warning in the Window»Show Error List window if you placed a checkmark in the Show Warnings checkbox in the Error list window
...
© National Instruments Corporation 3-9 LabVIEW Basics I Course Manual Lesson 3 Creating a SubVI LabVIEW sets inputs and outputs of VIs you create to Recommended by default
...
Refer to the Read File function located on the Functions»File I/O palette for examples of required, recommended, and optional inputs and outputs
...
com Lesson 3 Exercise 3-2 Objective: Creating a SubVI Thermometer VI To build a VI and create its icon and connector pane so you can use it as a subVI
...
The sensor returns a voltage proportional to temperature
...
23 V
...
Measure the voltage using the plug-in DAQ device in your computer and convert the voltage into a temperature reading
...
Front Panel 1
...
(Windows, Sun, and HP-UX) If you closed all open VIs, click the New VI button on the LabVIEW dialog box
...
Create the thermometer indicator, as shown in the following front panel
...
Select the thermometer on the Controls»Numeric palette and place it on the front panel
...
Type Temperature inside the label and click outside the label or click the Enter button on the toolbar, shown at left
...
Right-click the thermometer and select Visible Items»Digital Display from the shortcut menu to display the digital display for the thermometer
...
Create the vertical switch control
...
Select the vertical toggle switch on the Controls»Boolean palette
...
Type Temp Scale inside the label and click outside the label or click the Enter button
...
Use the Labeling tool, shown at left, to place a free label, deg C, next to the TRUE position of the switch, as shown in the previous front panel
...
Place a free label, deg F, next to the FALSE position of the switch
...
Document the VI with a description that appears in the Context Help window when you move the cursor over the VI icon
...
Select File»VI Properties
...
b
...
c
...
d
...
5
...
a
...
b
...
c
...
d
...
e
...
f
...
g
...
h
...
6
...
7
...
Block Diagram 8
...
9
...
LabVIEW Basics I Course Manual 3-12 ni
...
Place the Read Voltage VI located on the Functions»User Libraries»Basics I Course palette
...
Note If a DAQ device and/or DAQ Signal Accessory is not available, use the (Demo) Read Voltage VI located on the Functions»User Libraries»Basics I Course palette instead of the Read Voltage VI to simulate the Read Voltage VI operation
...
Place the Multiply function located on the Functions»Numeric palette
...
0 to obtain the Celsius temperature
...
Select Functions»Select a VI, navigate to c:\exercises\LV Basics I, double-click the Convert C to F VI, which you built in Exercise 3-1, and place the VI
...
d
...
This function returns either the Fahrenheit (FALSE) or Celsius (TRUE) temperature value, depending on the value of Temp Scale
...
Right-click the device terminal of the Read Voltage VI, select Create»Constant, type 1, and press the key to create a numeric constant
...
Right-click the y terminal of the Multiply function, select Create»Constant, type 100, and press the key to create another numeric constant
...
Right-click the channel terminal of the Read Voltage VI, select Create»Constant, type 0, and press the keys to create a string constant
...
Use the Positioning tool, shown at left, to place the icons as shown in the previous block diagram and use the Wiring tool, shown at left, to wire them together
...
Tip © National Instruments Corporation 3-13 LabVIEW Basics I Course Manual Lesson 3 Creating a SubVI 10
...
11
...
12
...
13
...
14
...
a
...
The Icon Editor dialog box appears
...
Double-click the Select tool, shown at left, on the left side of the Icon Editor dialog box to select the default icon
...
Press the key to remove the default icon
...
Double-click the Rectangle tool, shown at left, to redraw the border
...
Use the Pencil tool, shown at left, to draw an icon that represents the thermometer
...
Use the Foreground and Fill tools to color the thermometer red
...
g
...
h
...
i
...
The icon appears in the upper right corner of the front panel
...
com Lesson 3 Creating a SubVI 15
...
a
...
b
...
The left terminal turns green
...
Click the right terminal in the connector pane
...
Click the Temperature indicator
...
e
...
16
...
a
...
b
...
c
...
vi in the dialog box
...
Click the Save button
...
Select File»Close to close the VI
...
Creating a SubVI from Sections of a VI You can simplify the block diagram of a VI by converting sections of the block diagram into subVIs
...
An icon for the new subVI replaces the selected section of the block diagram
...
The following example shows how to convert a selection into a subVI
...
LabVIEW Basics I Course Manual 3-16 ni
...
Using subVIs helps you manage changes and debug the block diagram quickly
...
• The connector pane is a set of terminals that corresponds to the controls and indicators of that VI
...
• Create custom icons to replace the default icon by double-clicking the icon in the upper right corner of the front panel
...
• You can designate which inputs and outputs are required, recommended, and optional to prevent users from forgetting to wire subVI connections by right-clicking a terminal in the connector pane and selecting This Connection Is from the shortcut menu
...
When you move the cursor over a VI icon, the Context Help window displays this description and indicates which terminals are required, recommended, or optional
...
When you move the cursor over controls and indicators, the Context Help window displays this description
...
© National Instruments Corporation 3-17 LabVIEW Basics I Course Manual Lesson 3 Creating a SubVI Additional Exercise 3-3 Build a VI that calculates the slope between two X-Y pairs, as shown in the following front panel and block diagram
...
Select the slope calculation and select Edit»Create SubVI to make a subVI
...
vi
...
com Lesson 3 Creating a SubVI Notes © National Instruments Corporation 3-19 LabVIEW Basics I Course Manual Lesson 3 Creating a SubVI Notes LabVIEW Basics I Course Manual 3-20 ni
...
Use structures in the block diagram to repeat blocks of code and to execute code conditionally or in a specific order
...
This lesson introduces the While Loop, For Loop, and the waveform chart and shift register
...
How to use a While Loop B
...
What a shift register is and how to use it D
...
While Loops Similar to a Do Loop or a Repeat-Until Loop in text-based programming languages, a While Loop, shown at left, executes a subdiagram until a condition is met
...
Then use the cursor to click-and-drag a selection area around the code you want to repeat
...
The completed While Loop is a resizable box
...
Conditional Terminal Iteration Terminal The While Loop executes the subdiagram until the conditional terminal, an input terminal, receives a specific Boolean value
...
When a conditional terminal is Continue If True, the While Loop executes its subdiagram until the conditional terminal receives a FALSE value
...
The iteration count always starts at zero
...
A While Loop is equivalent to the following pseudo-code: Do Execute Diagram Inside the Loop (which sets the condition) While the condition is TRUE LabVIEW Basics I Course Manual 4-2 ni
...
The And function outputs a TRUE only if both inputs are TRUE; otherwise, it outputs a FALSE
...
When a conditional terminal is Stop If True, the While Loop executes its subdiagram until the conditional terminal receives a TRUE value, as shown in the following block diagram
...
0 AND the Enable control is pushed (TRUE)
...
Waveform Charts The waveform chart is a special numeric indicator that displays one or more plots
...
Waveform charts can display single or multiple traces
...
Charts use three different modes to scroll data, as shown in the following front panel
...
Select Strip Chart, Scope Chart, or Sweep Chart
...
A strip chart shows running data continuously scrolling from left to right across the chart
...
A sweep display is similar to an EKG display
...
The scope chart and sweep chart have retracing displays similar to an oscilloscope
...
LabVIEW Basics I Course Manual 4-4 ni
...
The data type displayed in the waveform chart terminal icon matches the input type, as shown in the following block diagram
...
You must bundle the data together using the Bundle function located on the Functions»Cluster palette
...
Notice the change in the waveform chart terminal icon
...
© National Instruments Corporation 4-5 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts Exercise 4-1 Objective: Temperature Monitor To use a While Loop and a waveform chart for acquiring data in real time
...
Front Panel 1
...
2
...
You will use the switch to stop the acquisition
...
Type Power inside the label and click outside the label or click the Enter button on the toolbar, shown at left
...
Select a waveform chart on the Controls»Graph palette and place it on the front panel
...
5
...
6
...
7
...
0 in the waveform chart scale, type 90, and click outside the label or click the Enter button
...
0 to 70 in the same way
...
LabVIEW Basics I Course Manual 4-6 ni
...
Select Window»Show Diagram to display the block diagram
...
Enclose the two terminals inside a While Loop
...
Select a While Loop on the Functions»Structures palette
...
Click and drag a selection rectangle around the two terminals
...
Use the Positioning tool to drag one corner to enlarge the loop
...
Select Functions»Select a VI, navigate to c:\exercises\LV Basics I, double-click the Thermometer VI, which you built in Exercise 3-2, and place the VI on the block diagram
...
11
...
To measure temperature in Celsius, wire a Boolean constant located on the Functions»Boolean palette to the Temp Scale input of the Thermometer VI
...
Note READ NOTE PRIOR TO WIRING 12
...
vi, because you will use this VI later in the course
...
Display the front panel by clicking it or by selecting Window»Show Panel
...
Use the Operating tool to click the vertical toggle switch and turn it to the ON position
...
Run the VI
...
The diagram within its border executes as long as the specified condition is true
...
16
...
This changes the loop condition to FALSE and the loop ends
...
Format and customize the X and Y scales of the waveform chart to suit your display preferences and data
...
Right-click the chart and select Y Scale»Formatting from the shortcut menu
...
b
...
You also can experiment with scale styles, scaling factors, mapping mode, and the format and precision of the axis displays
...
Select the values shown in the previous dialog box and click the OK or Cancel buttons
...
Right-click the waveform chart and select Data Operations»Clear Chart from the shortcut menu to clear the display buffer and reset the waveform chart
...
LabVIEW Basics I Course Manual 4-8 ni
...
With LabVIEW, you can modify the mechanical action of Boolean controls
...
For example, consider the following vertical toggle switch
...
Switch When Pressed—Changes the control value each time you click the control with the Operating tool
...
How often the VI reads the control does not affect this action
...
How often the VI reads the control does not affect this action
...
The action is similar to that of a door buzzer
...
Latch When Pressed—Changes the control value when you click the control and retains the new value until the VI reads it once, at which time the control reverts to its default value
...
This action is similar to that of a circuit breaker and is useful for stopping While Loops or having the VI do something only once each time you set the control
...
When the VI reads the value once, the control reverts to the old value
...
Latch Until Released—Changes the control value when you click the control and retains the value until the VI reads the value once or until you release the mouse button, whichever occurs last
...
Modify the vertical toggle switch so temperature is plotted on the graph each time you run the VI
...
Stop the VI if it is running
...
Use the Operating tool to click the vertical toggle switch and turn it to the ON position
...
Right-click the switch and select Data Operations»Make Current Value Default from the shortcut menu
...
d
...
20
...
21
...
The switch changes to the OFF position and changes back to ON after the While Loop condition terminal reads the value
...
However, you might want to take data at certain intervals, such as once per second or once per minute
...
This function ensures that no iteration is shorter than the specified number of milliseconds
...
com Lesson 4 Loops and Charts 22
...
Wait Until Next ms Multiple function located on the Functions»Time & Dialog palette
...
Numeric Constant located on the Functions»Numeric palette
...
Thus, the loop executes once every half-second
...
Change the dX value to 0
...
0 10-1) because you added a 500 ms wait between loop iterations
...
Save the VI, because you will use this VI later in the course
...
Run the VI
...
25
...
End of Exercise 4-1 © National Instruments Corporation 4-11 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts Exercise 4-2 Objective: Random Signal (Optional) To implement timing of a data display by using a numeric control and a waveform chart
...
The VI should have a knob control on the front panel to adjust the loop rate between 0 and 2 seconds
...
You should not need to turn on the switch each time you run the VI
...
Hints: 1
...
2
...
3
...
4
...
Use this value as the input to the Wait Until Next ms Multiple function located on the Functions»Time & Dialog palette
...
Right-click the chart and select Advanced»Update Mode from the shortcut menu to set the chart mode
...
Save the VI as Random Signal
...
End of Exercise 4-2 LabVIEW Basics I Course Manual 4-12 ni
...
Build a VI that generates random numbers until the number generated matches the specified number
...
Front Panel 1
...
2
...
Modify the controls and indicators as shown and described in this exercise
...
The Current Number indicator displays the current random number
...
Setting the Data Range The Data Range option prevents you from setting a value that is not compatible with a preset range or increment
...
Complete the following steps to set the range between 0 and 10,000 with an increment of 1 and a default value of 50
...
Right-click the digital control and select Data Range from the shortcut menu
...
© National Instruments Corporation 4-13 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts 4
...
5
...
6
...
Modifying Digits of Precision By default, numeric controls and indicators are displayed in decimal notation with two decimal places, for example, 3
...
You can use the Format & Precision option to change the precision or to display the numeric controls and indicators in scientific, engineering, or hour/minute/second notation
...
7
...
You must stop the VI to access the menu
...
Type 0 in Digits of Precision and click the OK button
...
com Lesson 4 Loops and Charts Block Diagram 9
...
Random Number (0-1) function located on the Functions»Numeric palette returns a random number between 0 and 1
...
To create the numeric constant, right-click the second input of the Multiply function and select Create»Constant from the shortcut menu
...
0 and 10000
...
Round To Nearest function located on the Functions»Numeric palette rounds the random number between 0 and 10,000 to the nearest whole number
...
Increment function located on the Functions»Numeric palette increments the While Loop count by one
...
Through tunnels, data flow into or out of a looping structure
...
When a tunnel passes data into a loop, the loop executes only after data arrive at the tunnel
...
That is, the Not Equal? function returns TRUE as long as the two numbers do not match
...
The iteration count passes out of the loop upon completion
...
© National Instruments Corporation 4-15 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts 10
...
vi
...
Display the front panel and enter a number in the Number to Match control
...
Run the VI several times
...
The Current Number indicator updates at every iteration of the loop because it is inside the loop
...
If you have trouble seeing how the VI updates the indicators, enable execution highlighting
...
This mode slows the VI so you can see each number as it is generated
...
Type a number in the Number to Match control that is out of the data range, which was originally set to between 0 and 10,000 with an increment of 1
...
Run the VI
...
15
...
End of Exercise 4-3 LabVIEW Basics I Course Manual 4-16 ni
...
Shift Registers With While Loops and For Loops, you can use shift registers to transfer values from one iteration to the next
...
The shift register contains a pair of terminals directly opposite each other on the vertical sides of the loop border
...
Those data are shifted at the end of the iteration and they appear in the left terminal at the beginning of the next iteration, as shown in the following figure
...
The shift register automatically adapts to the data type of the first object wired to the shift register
...
This feature is useful when you average data points
...
For example, if you add two more elements to the left terminal, you access values from the last three iterations
...
Right-click on the left terminal to add new elements
...
2 loops ago
...
Latest value is passed to right terminal
...
Right-click on the border for a new shift register
...
Initializing Shift Registers To initialize the shift register with a specific value from outside the loop, wire the initial value to the left terminal of the shift register
...
For example, if the shift register data type is Boolean, the initial value is FALSE
...
LabVIEW does not discard values stored in the shift register until you close the VI and remove it from memory
...
Note Uninitialized Shift Registers Run 1 Initialized Shift Registers Run 1 Initial Value 0 Initial Value 5 Run 2 Run 2 Initial Value 5 Initial Value 7 LabVIEW Basics I Course Manual 4-18 ni
...
Front Panel 1
...
vi
...
The X(i) indicator displays the current value, which shifts to the left terminal at the beginning of the next iteration
...
2
...
If necessary, close or move the Tools and Functions palettes
...
Block Diagram © National Instruments Corporation 4-19 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts 3
...
4
...
If the bubbles are moving too fast, click the Pause and Step Over buttons, shown at left, to slow the execution
...
Each iteration of the loop adds 5 to the current data, X(i)
...
The values at the left terminal funnel downward through the terminals
...
To retain more values, add more elements to the left terminal of the shift register
...
Close the VI
...
End of Exercise 4-4 LabVIEW Basics I Course Manual 4-20 ni
...
Modify the Temperature Monitor VI to average the last three temperature measurements and display the average on a waveform chart
...
Open the Temperature Monitor VI, which you built in Exercise 4-1
...
Select File»Save As and rename the VI Temperature Running Average
...
Block Diagram 3
...
© National Instruments Corporation 4-21 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts 4
...
5
...
6
...
7
...
This VI returns one temperature measurement from the temperature sensor and is used to initialize the left shift registers before the loop starts
...
Place the Positioning tool at the corner of the function until the cursor changes to the resizing handles, shown at left
...
The Divide function located on the Functions»Numeric palette returns the average of the last three temperature readings
...
The VI adds this value to the last two measurements stored in the left terminals of the shift register
...
The VI displays the average on the waveform chart
...
8
...
9
...
Multiplot Charts Charts can accommodate more than one plot
...
10
...
a
...
LabVIEW Basics I Course Manual 4-22 ni
...
This function bundles, or groups, the average and current temperature for plotting on the waveform chart
...
You can add additional elements using the Positioning tool
...
Save and run the VI
...
The plots are overlaid
...
Customizing Charts You can customize waveform charts to match your data display requirements or to display more information
...
By default, a waveform chart displays the graph legend showing when you place it on a front panel
...
Customize the y-axis
...
Use the Labeling tool to click 70
...
0, and press the key
...
Use the Labeling tool to click the second number from the bottom on the Y axis
...
5 or 80
...
This number determines the numerical spacing of the Y axis divisions
...
0 is 77
...
5, changing the 77
...
0 reformats the Y axis to multiples of 5
...
0, 80
...
0, and so on)
...
Increase the waveform chart size if you encounter problems customizing the axis
...
Right-click the waveform chart and select Visible Items»Scale Legend from the shortcut menu to show the scale legend
...
The scale legend contains the following components
...
Use the scale legend to customize each axis
...
Type in the scale labels of the legend or directly type in the labels on the chart to change the axis labels
...
Click the Autoscale button for the Y axis to make the scale adjust the minimum and maximum values to fit the data in the chart
...
c
...
d
...
14
...
You can move the plot legend anywhere on the front panel
...
To change Temp to Running Avg, double-click the label with the Labeling tool and type in LabVIEW Basics I Course Manual 4-24 ni
...
Change Plot 1 to Current Temp in the same way
...
The Positioning tool changes to a frame corner when you can resize the plot legend
...
You also can color the plot background or traces by right-clicking the plot legend and selecting Color from the shortcut menu
...
Right-click the waveform chart and select Visible Items»Graph Palette from the shortcut menu to show the graph palette
...
The graph palette contains the following options
...
The Pan button allows click-and-drag scrolling (panning) in the chart
...
16
...
While you run the VI, use the buttons in the scale legend and graph palette to modify the waveform chart
...
Often, modifying the axis text format requires more physical space than was originally set aside for the axis
...
Note 17
...
18
...
End of Exercise 4-5 © National Instruments Corporation 4-25 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts D
...
You select a For Loop on the Functions»Structures palette and enclose the code you want to repeat in the For Loop boundary
...
The count terminal specifies the number of times to execute the loop
...
The For Loop differs from the While Loop in that the For Loop executes a predetermined number of times
...
The For Loop is equivalent to the following pseudo-code: For i = 0 to N-1 Execute Diagram Inside The Loop The following example shows a For Loop that generates 100 random numbers and displays the points on a waveform chart
...
LabVIEW, however, can represent numeric data types as integers (byte, word, or long), floating-point numbers (single, double, or extended precision), or complex numbers (single, double, or extended precision)
...
As a reminder, LabVIEW places a dot, called a coercion dot, on the terminal where the conversion takes place
...
The terminal representation is long integer
...
Notice the gray dot in the count terminal of the first For Loop
...
com Lesson 4 Loops and Charts Gray Dot To change the representation of a front panel numeric object, right-click the front panel object or its block diagram terminal and select Representation from the shortcut menu
...
When the VI converts floating-point numbers to integers, the VI rounds to the nearest integer
...
5 is rounded to the nearest even integer
...
5 is rounded to 2 and 3
...
© National Instruments Corporation 4-27 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts Exercise 4-6 Objective: Random Average To build a VI that displays two random plots on a waveform chart in sweep update mode
...
Use a For Loop (N = 200) instead of a While Loop
...
Use the following hints to build the block diagram
...
Use a shift register with three left terminals to average the last four data points
...
Use the Random Number (0-1) function located on the Functions» Numeric palette to generate the data
...
Use the Bundle function located on the Functions»Cluster palette to group the random data with the averaged data before plotting
...
Save the VI as Random Average
...
End of Exercise 4-6 LabVIEW Basics I Course Manual 4-28 ni
...
• The While Loop executes until the Boolean value wired to the conditional terminal is TRUE
...
• The For Loop executes a predetermined number of times, such as the value wired to the count terminal
...
• The Wait Until Next ms Multiple function ensures that no iteration is shorter than a specified number of milliseconds
...
• The waveform chart is a special numeric indicator that displays one or more plots
...
– The scope chart plots data until they reach the right border, erases the plot, and retraces the plot from left border
...
• Shift registers are used to record stored values from one iteration of a loop to the next
...
• Right-click a waveform chart or its components to set attributes and preferences of the chart and its plots
...
© National Instruments Corporation 4-29 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts Additional Exercises 4-7 Challenge Using only a While Loop, build a combination For Loop/While Loop that stops either when it reaches a user-specified number of iterations, specified on a front panel control, or when a user pushes a stop button
...
vi
...
If the temperature goes above or below the preset limits, the VI turns on a front panel LED
...
You should be able to set the limit from the following front panel
...
vi
...
You must use shift registers and two Max & Min functions located on the Functions»Comparison palette
...
vi
...
com Lesson 4 Loops and Charts Notes © National Instruments Corporation 4-31 LabVIEW Basics I Course Manual Lesson 4 Loops and Charts Notes LabVIEW Basics I Course Manual 4-32 ni
...
You Will Learn: A
...
B
...
C
...
D
...
E
...
F
...
G
...
© National Instruments Corporation 5-1 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters A
...
An array has one or more dimensions and up to 231 elements per dimension, memory permitting
...
However, you cannot have an array of arrays, charts, or graphs
...
The index is in the range 0 to N-1, where N is the number of elements in the array
...
Notice that the first element has index 0, the second element has index 1, and so on
...
2 3
...
2 8
...
8 5
...
0 1
...
5 1
...
Step 1 Select an empty array shell from the Controls»Array & Cluster palette
...
LabVIEW Basics I Course Manual 5-2 ni
...
If you do not assign a data object, the array terminal will appear black with an empty bracket
...
The example below is an N-row by M-column array, where N=5 and M=7
...
The example above shows a 2D digital control array
...
Array constants are a combination of an Array Constant shell, available on the Functions»Array palette, and a data constant
...
© National Instruments Corporation 5-3 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters Step 1 Select an empty Array Constant shell from the Functions»Array palette
...
Different data objects include numeric, Boolean, string, or cluster constants from the Functions palette
...
com Lesson 5 Arrays, Graphs, and Clusters B
...
This capability is called auto-indexing
...
Each iteration creates the next array element
...
Notice that the wire becomes thicker as it changes to an array at the loop border and that the tunnel contains square brackets
...
In the illustration below, auto-indexing is disabled, and only the last value returned from the Random Number (0-1) function passes out of the loop
...
Auto-Indexing Disabled Wire remains same size Only one value (last iteration) passed out of the loop Because For Loops are often used to process arrays, LabVIEW enables auto-indexing by default when you wire an array into or out of For Loops
...
You must right-click the While Loop tunnel and select Enable Indexing from the shortcut menu
...
The outer For Loop creates the row elements, and the inner For Loop creates the column elements
...
1D Array 2D Array Using Auto-Indexing to Set the For Loop Count When you enable auto-indexing on an array entering a For Loop, LabVIEW automatically sets the loop iteration count to the array size, thus eliminating the need to wire a value to the count terminal, N
...
In the example below, the array size, and not N, sets the For Loop count because the array size is the smaller of the two
...
Array Size = 10 LabVIEW Basics I Course Manual 5-6 ni
...
Array Functions LabVIEW has many functions to manipulate arrays, available on the Functions»Array palette
...
Array Size returns the number of elements in the input array
...
Each element records the number of elements in each dimension
...
You can resize the function to correspond to the number of dimensions of the output array
...
Build Array function when placed on the block diagram Build Array concatenates multiple arrays or appends elements to an array
...
You can resize this function to increase the number of inputs
...
© National Instruments Corporation 5-7 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters The inputs to the Build Array function automatically adjust to element or array inputs depending on what datatype you wire to them
...
You can right-click the Build Array function and select the Concatenate Inputs option to perform the operation shown in the second diagram
...
Index Array accesses an element of an array
...
Notice that the third element’s index is 2 because the index starts at zero; that is, the first element has index 0
...
com Lesson 5 Arrays, Graphs, and Clusters In the previous example, the Index Array function extracts a scalar element from an array
...
To do this, wire a 2D array to the input of the Index Array function
...
The top index terminal specifies the row, and the second terminal specifies the column
...
The VI below indexes the second row from a 2D array
...
Polymorphism The LabVIEW numeric functions are polymorphic
...
For example, you can add a scalar to an array or add two arrays together
...
Combination Result Scalar + Scalar Scalar Scalar + Array Array Array + Array Array Array + Array Array In the first combination, the result is a scalar
...
In the third combination, each element of one array is added to the corresponding element of the other array
...
In the following example, each iteration of the For Loop generates one random number stored in the array created at the border of the loop
...
The front panel indicator then displays the array
...
com Lesson 5 Exercise 5-1 Objective: Arrays, Graphs, and Clusters Array Exercise VI To create arrays and become familiar with array functions
...
Front Panel 1
...
a
...
Place an array shell, available on the Controls»Array & Cluster palette, on the front panel
...
Place a digital indicator, available on the Controls»Numeric palette, inside the array shell using the shortcut menu
...
Choose a digital indicator from the Numeric subpalette and place it into the array shell
...
Create two more digital array indicators to display data in Final Array and Subset Array
...
Place three digital controls to correspond to Scaling Factor, Start Subset, and # of Elements
...
© National Instruments Corporation 5-11 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters The VI will generate an array of 10 random numbers, scale them by the value in Scaling Factor, take a subset of that Final Array starting at Start Subset for # of Elements, and display the subset in Subset Array
...
Build the block diagram shown above
...
To set the loop to run 10 times, right-click the N and select Create»Constant from the shortcut menu
...
Random Number function, available on the Functions»Numeric palette—Generates a random number between 0 and 1
...
Array Subset, available on the Functions»Array palette—Removes a portion of an array starting where you specify and for a length you specify
...
4
...
vi
...
Return to the front panel and run the VI a few times
...
Each iteration generates a random number and stores it at the loop boundary
...
Then each value in the Random Array is multiplied by Scaling Factor to create Final Array
...
6
...
End of Exercise 5-1 LabVIEW Basics I Course Manual 5-12 ni
...
Graphs A graph indicator is a 2D display of one or more data arrays called plots
...
Both types look identical on the front panel of your VI
...
Plot Legend (Point and Line Styles) Graph Palette Scale Legend The waveform graph indicator is available on the Controls»Graph palette
...
The waveform graph is ideal for plotting arrays of data in which the points are evenly distributed
...
This method assumes the initial X value and the delta X value are 0 and 1, respectively
...
1D array © National Instruments Corporation 5-13 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters You can bundle data consisting of the initial X value, the delta X value, and a data array to the waveform graph
...
Notice that the graph icon changes, as shown below
...
The examples shown below detail two methods for wiring multiple-plot waveform graphs
...
2D array 1D array The example above assumes the initial X value is 0 and the delta X value is 1 for both arrays
...
These X parameters do not need to be the same for both sets of data
...
LabVIEW Basics I Course Manual 5-14 ni
...
The Bundle function, available on the Functions»Cluster palette, combines the X and Y arrays into a cluster wired to the XY graph
...
The XY graph now appears as a cluster indicator
...
Build a VI that generates and plots an array in a waveform graph and modify the VI to graph multiple plots
...
Open a new VI and build the front panel shown below
...
a
...
Label the array shell Waveform Array
...
This indicator displays the array contents
...
b
...
LabVIEW Basics I Course Manual 5-16 ni
...
Build the block diagram shown above
...
In this exercise, the VI returns one point of simulated temperature data during each For Loop iteration
...
The VI generates 100 temperature values at the border of the For Loop
...
Right-click the count terminal and select Create»Constant
...
Count terminal 3
...
Each iteration of the For Loop will generate a temperature value and store it in an array at the loop border (tunnel)
...
Save the VI
...
vi
...
Return to the front panel and run the VI
...
6
...
If you enter a number greater than the array size, the display dims
...
Place the Positioning tool on the lower-right corner of the array until the tool appears as shown at left and drag
...
Index © National Instruments Corporation 9 5-17 10 11 12 13 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters In the previous block diagram, you used the default value of the initial X and delta X value for the waveform
...
In these instances, you can use the Bundle function to specify an initial and delta X value for a waveform array
...
Return to the block diagram
...
Finish wiring the block diagram as shown above
...
The components include the initial X value (10), the delta X value (1
...
Use the Positioning tool to resize the function by dragging one of the corners
...
Select the D using the Labeling tool and then select the Symbol font from the Font Ring
...
Font ring After the loop finishes execution, the Bundle function bundles the initial value of X (Xo), the delta value of X, and the array for plotting on the graph
...
Return to the front panel
...
The VI plots the auto-indexed waveform array on the waveform graph
...
5
...
Change the delta X value to 0
...
Notice that the graph now displays the same 100 points of data with a starting value of 20 and a delta X of 0
...
In a timed test, this graph would correspond to 50 seconds worth of data starting at 20 seconds
...
10
...
View the graph palette by right-clicking the waveform graph and selecting Visible Items»Graph Palette from the shortcut menu
...
com Lesson 5 Arrays, Graphs, and Clusters zooming features on the palette to see the data on the graph in more detail
...
11
...
Right-click the waveform graph and select X Scale» Formatting from the shortcut menu
...
a
...
b
...
c
...
d
...
m
...
00)
...
Click the OK button to apply your changes
...
Change the bundle’s Xo and ∆X to 0 and 1, respectively, to match the example
...
0 7:30 10:50 (7:30 + 20 × 10 min
...
5 10:00
...
) 5 min
...
× 0
...
Note If the x-axis text is not clearly visible, shrink the inner display (black area) of the graph with the Positioning tool to increase the border area around the graph
...
12
...
Sine function, available on the Functions»Numeric»Trigonometric palette—In this exercise, you use the function in a For Loop to build an array of points that represents one cycle of a sine wave
...
com Lesson 5 Arrays, Graphs, and Clusters Build Array function, available on the Functions»Array palette—In this exercise, this function creates the proper data structure to plot two arrays on a waveform graph
...
Pi constant, available on the Functions»Numeric»Additional Numeric Constants palette
...
Switch to the front panel
...
Notice that the two waveforms plot on the same waveform graph
...
Return to the block diagram
...
a
...
b
...
15
...
Notice that the probe shows only the data array
...
Close the probe window
...
Zoom in on a portion of the graph
...
The Zooming palette, shown below, appears
...
Click and drag a selection area on the graph
...
You also can select Zoom by Y Rectangle or Zoom by Selected Area
...
To undo a zoom, select “Undo Zoom” from the lower left corner of the Zooming palette or click on the X axis single fit button followed by the Y axis single fit button on the main Graph palette
...
Scroll through your data using the Pan feature
...
Notice that the mouse cursor changes to a hand
...
As long as you hold down the mouse button, you can drag the display
...
Finally, return the mouse to standard mode by clicking the Return to standard mode button
...
Save and close the Graph Waveform Array VI
...
com Lesson 5 Exercise 5-3 Objective: Arrays, Graphs, and Clusters Temperature Analysis VI To graph data and use the analysis VIs
...
25 s for 10 s
...
After the acquisition is complete, the VI plots the data on a graph and calculates the minimum, maximum, and average temperatures
...
You will use this VI later, so be sure to save it as the instructions below describe
...
Open a new VI and build the front panel shown below
...
Change the label from "Plot 0" to "Temp" and "Plot 1" to "Fitted" with the Labeling tool
...
After acquisition, the VI plots the data and its best fit in Temp Graph
...
Block Diagram 2
...
Refer to the following instructions
...
This feature not only saves space on the front panel, it is also an effective means of making comparisons between plots
...
Thermometer VI, available on the Functions»User Libraries»Basics 1 Course palette—Returns one temperature measurement
...
25 s (250 ms) in this exercise
...
Mean VI, available on the Functions»Mathematics»Probability and Statistics palette—Returns the average of the temperature measurements in this exercise
...
The components include the initial X value (0), the delta X value (0
...
Use the Positioning tool to resize the function by dragging one of the corners
...
This exercise uses five as the polynomial order
...
LabVIEW Basics I Course Manual 5-24 ni
...
You can increase the number of inputs for the function using the same method you employed for the Bundle function
...
3
...
Name it Temperature Analysis
...
4
...
5
...
Try different values for the polynomial order constant in the block diagram
...
The Wait Until Next ms Multiple function causes each iteration to take place every 250 ms
...
After the For Loop completes, the array passes to various nodes
...
The Mean VI returns the average of the temperature measurements
...
25
...
25 is required so that the VI plots the temperature array points every 0
...
6
...
You can create histogram graphs, general bar plots, or filled plots
...
You can configure the point, line, and fill styles in one step
...
Right-click the Temp plot display in the legend of the Temp graph
...
© National Instruments Corporation 5-25 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters b
...
7
...
End of Exercise 5-3 LabVIEW Basics I Course Manual 5-26 ni
...
Build a VI that plots a circle using independent X and Y arrays
...
Open a new VI
...
Place an XY Graph, available on the Controls»Graph palette, on the front panel
...
Change Plot 0 to Circle in the plot legend
...
Right-click the plot in the plot legend and select the small square from the Point Style palette
...
Build the block diagram shown above
...
Bundle function, available on the Functions»Cluster palette—Assembles the sine array and the cosine array to plot the sine array against the cosine array in this exercise
...
Using a Bundle function, you can graph the one-cycle Sine array versus the one-cycle Cosine array on an XY graph, which produces a circle
...
5
...
vi
...
Return to the front panel
...
7
...
End of Exercise 5-4 Chart and Graph Use Summary When you first use the charts and graphs in LabVIEW, it can be confusing when you try to wire data to them
...
For example, if you select Help»Show Context Help and put the cursor over a Waveform Graph terminal in the block diagram, you will see the following information: LabVIEW Basics I Course Manual 5-28 ni
...
These examples are located in the Help»Examples»Fundamentals»Graphs and Charts category
...
The waveform data type mentioned in the Context Help window is described in Lesson 8, Data Acquisition and Waveforms
...
Clusters You used the Bundle function with charts and graphs to group information for the plots
...
A cluster is a data structure that combines one or more data components into a new data type
...
A cluster is analogous to a record in Pascal or a struct in C
...
Each wire in the cable represents a different component of the cluster
...
Unbundle the cluster in the diagram to access its components
...
Creating Cluster Controls and Indicators on the Front Panel Create cluster controls and indicators on a VI front panel by placing a cluster shell on the front panel
...
Then click the front panel to place the cluster
...
LabVIEW Basics I Course Manual 5-30 ni
...
You can deposit objects directly inside the cluster by dragging an object into a cluster
...
The cluster assumes the data direction (control or indicator) of the first object you place inside the cluster
...
A cluster of four controls is shown below: Creating Cluster Constants on the Block Diagram To create a cluster constant on the block diagram, you can use the same technique you used on the front panel
...
Click the block diagram to place the cluster shell, and place other constants of the appropriate data type within the cluster shell
...
Cluster Order When LabVIEW manipulates clusters of data, the data types of the individual components within the cluster and the order of the components in the cluster are both important
...
The first object placed in the cluster shell is component 0, the second is component 1, and so on
...
You can change the order of the objects within the cluster by right-clicking the cluster border and selecting Reorder Controls in Cluster from the shortcut menu
...
The white box on each component shows its current place in the cluster order
...
LabVIEW Basics I Course Manual 5-32 ni
...
Then click the desired component
...
You will also notice that the cluster order indices of the other components adjust automatically
...
You can revert to the original settings by clicking the Revert to Original button
...
The example shown below shows the importance of cluster order
...
In the first cluster, component 0 is a numeric control and component 1 is a string control
...
The cluster control correctly wires to the cluster indicator as shown
...
If you try to run the VI, you get an error message stating that there is a type conflict because the data types do not match
...
When you use a connector pane that has a large number of terminals, the terminals are very small and difficult to wire
...
LabVIEW Basics I Course Manual 5-34 ni
...
One cluster control uses one terminal on the connector pane, but that cluster can contain several controls
...
Because your subVI uses clusters containing several items each, you can use fewer, and therefore larger, terminals on the connector pane
...
© National Instruments Corporation 5-35 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters G
...
The Bundle and Bundle by Name functions assemble and modify clusters, and the Unbundle and Unbundle by Name functions disassemble clusters
...
The topmost component wired to the Bundle function is component 0 in the cluster order, the second component is component 1, and so on
...
If the cluster of n components terminal is wired, the number of input terminals to the Bundle function must match the number of items in the input cluster
...
Instead, you can wire data only to the items you want to change
...
LabVIEW Basics I Course Manual 5-36 ni
...
You must know the cluster order to do this correctly
...
Bundle by Name works similarly to the Bundle function, but instead of referencing cluster components by their cluster order, it references them by their owned labels
...
Operating tool Select a component by clicking an input terminal using the Operating tool and selecting a name from the list of components in the cluster
...
Notice that you must wire an input cluster to the cluster of N named components input of this function, and at least one item in the input cluster must have a name
...
For example, consider again the cluster control containing the controls labeled Command, Function, and Trigger
...
To select the name Command, click the left terminal of the Bundle by Name function using the Operating tool and select Command from the list of names
...
Use the Bundle by Name function when working with data structures that might change during the development process
...
Disassembling Clusters Positioning tool Operating tool LabVIEW Basics I Course Manual The Unbundle function, available on the Functions»Cluster palette, splits a cluster into each of its individual components
...
You can increase the number of outputs by resizing the function with the Positioning tool or by using the shortcut menu
...
The Unbundle by Name function, available on the Functions»Cluster palette, returns the cluster components that you reference by name
...
You also can right-click an output terminal and select the component from the Select Item menu
...
The number of output terminals of the Unbundle by Name function does not depend on the number of components in the input cluster
...
com Lesson 5 Arrays, Graphs, and Clusters For example, if you use the Unbundle function with the cluster shown below, it has four output terminals
...
Notice that you need to know the cluster order so that you can associate the correct Boolean (TF) terminal of the unbundled cluster with the corresponding switch inside the cluster
...
Notice that when you use the Unbundle by Name function, you can have an arbitrary number of terminals and access specific components by name in any order
...
The Bundle and Unbundle functions will automatically contain the correct number of terminals
...
© National Instruments Corporation 5-39 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters Using Polymorphism with Clusters As you learned in the Array Functions section, many LabVIEW functions are polymorphic and can adapt to different input data types
...
As shown in the following example, you use the arithmetic functions with clusters in the same way you use them with arrays of numerics
...
Strings are covered in Lesson 7, Strings and File I/O
...
com Lesson 5 Exercise 5-5 Objective: Arrays, Graphs, and Clusters Cluster Exercise To create clusters on the front panel and use the cluster functions to assemble and disassemble cluster components
...
Open a new VI and build the front panel shown below
...
Place a round LED, digital indicator, and Stop button on the front panel
...
Place a cluster shell on the front panel by right-clicking and selecting Controls»Array & Cluster»Cluster
...
c
...
d
...
The cluster becomes an indicator when you place a digital indictor inside it
...
That is, the toggle switch becomes an indicator because the cluster itself is an indicator
...
To duplicate Cluster, select it using the Positioning tool, select Edit»Copy, click to a new area in the front panel, and select Edit»Paste
...
Repeat the process for the Small Cluster
...
f
...
The Modified Cluster should have the same order as the Cluster
...
Complete the cluster orders as shown below
...
Build the block diagram shown above
...
com Lesson 5 Arrays, Graphs, and Clusters Unbundle function, available on the Functions»Cluster palette—Disassembles the Cluster
...
The labels inside the function appear after you wire to it
...
The labels inside the function appear after you wire to it
...
Resize this function to have two output terminals
...
If the labels are not correct, right-click the existing label and select the correct one from the Select Item menu
...
Not function, available on the Functions»Boolean palette—Outputs the logical opposite of the value of Boolean 1
...
Resize this function to have two input terminals
...
If the labels are not correct, right-click the existing labels and select the correct one from the Select Item menu option
...
Right-click the conditional terminal of the While Loop and select Stop If True from the shortcut menu
...
3
...
vi
...
Run the VI
...
Notice that the components of Cluster are unbundled from Cluster and displayed in their corresponding indicators in Small Cluster and Modified Cluster
...
Close the VI when you are finished
...
This VI scales values stored in a cluster, where each component in the cluster has a different scale factor
...
The VI then scales these values to get the “actual” values present in the system
...
Open the Cluster Scaling VI
...
Finish building the block diagram
...
Build the block diagram shown above
...
3
...
Test several alternatives to ensure that the VI works properly
...
Close the VI when you are finished
...
com Lesson 5 Arrays, Graphs, and Clusters Summary, Tips, and Tricks • An array is a collection of data elements of the same type
...
• Remember that the index value is zero-based so the index representing the first element of an array has a value of zero
...
• Creating an array on the front panel is a two-step process
...
Then add the desired control or indicator to the shell
...
• In this lesson, you used array functions to work with only 1D arrays; however, the same functions work similarly with multidimensional arrays
...
This is done by having auto-indexing enabled at the loop tunnels
...
• Polymorphism is the ability of a function to adjust to input data of different data structures
...
• Graphs have many unique features that you can use to customize your plot display
...
• You can display more than one plot on a graph by using the Build Array function, available on the Functions»Array palette, and by using Bundle for charts and XY Graphs
...
• A cluster is a data structure that groups data, even data of different types
...
• If a VI has many front panel controls and indicators that you need to associate with terminals, you may want to group them into one or more clusters and use fewer terminals
...
First, create a cluster shell
...
© National Instruments Corporation 5-45 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters • • You can use the polymorphic capabilities of LabVIEW functions with arrays and clusters
...
• LabVIEW Basics I Course Manual The Bundle and Bundle by Name functions are used to assemble clusters
...
Use clusters to overcome the 24 terminal limitation on an icon and to group similar inputs and outputs together on a subVI
...
5-46 ni
...
For example, array[0] becomes array[99], array[1] becomes array[98], and so on
...
Name the VI Reverse Random Array
...
5-8 Build a VI that first accumulates an array of temperature values using the Process Monitor VI, available on the Functions»User Libraries»Basics I Course palette
...
Initialize an array, using the Initialize Array function, of the same size where all the values are equal to 10
...
Display the Temperature Array, the Initialized Array, the Final Array, and the Mid Value
...
vi
...
After generating the array, index each row and plot each row on its own graph
...
Name the VI Extract 2D Array
...
5-10 Build a VI that simulates the roll of a die with possible values 1–6 and keeps track of the number of times that the die rolls each value
...
Do this using only one shift register
...
vi
...
For example, the input array with values 1 23 10 5 7 11 results in the output array 23 50 77
...
vi
...
© National Instruments Corporation 5-47 LabVIEW Basics I Course Manual Lesson 5 Arrays, Graphs, and Clusters Notes LabVIEW Basics I Course Manual 5-48 ni
...
This lesson also introduces the Formula Node
...
How to use the Case structure
...
How to use the Sequence structure
...
How to use the Formula Node
...
How to replace Sequence structures
...
Case Structure You place the Case structure on the block diagram by selecting it from the Structures subpalette of the Functions palette
...
Selector terminal LabVIEW Basics I Course Manual The Case structure is analogous to case statements or if
...
else statements in conventional, text-based programming languages
...
Each case contains a subdiagram
...
The selector terminal can be numeric, Boolean, or string
...
If the data type is numeric or string, the structure can have up to 231–1 cases
...
com Lesson 6 Case and Sequence Structures Below is an example of a Boolean Case structure
...
If the Boolean wired to the selector terminal is True, the VI will add the numbers; otherwise, the VI will subtract the numbers
...
In this example, the numbers pass through tunnels to the Case structure, and are either added or subtracted, depending on the numeric value wired to the selector terminal
...
If the Text Ring Control wired to the selector terminal is 0 (add), the VI will add the numbers; otherwise, the value is 1 (subtract) and the VI will subtract the numbers
...
When you create an output tunnel in one case, tunnels appear at the same position in the other cases
...
Be sure to wire to the output tunnel for each unwired case, clicking on the tunnel itself each time
...
Below is an example of a string Case structure
...
In this case, if the String Control contains the characters “add” (quotes not included), the VI will add the numbers; otherwise, if the String Control contains the characters “subtract,” the VI will subtract the numbers
...
You can also edit the selector values using the labeling tool
...
To indicate a list, separate the values by commas, such as -1, 0, 5, 10
...
20, meaning all numbers from 10 to 20 inclusively
...
0 (all numbers less than or equal to 0), or 100
...
Lists and ranges can be combined such as
...
10, 12, 13, 14
...
com Lesson 6 Case and Sequence Structures contains overlapping ranges, the Case structure redisplays the selector in a more compact form
...
5, 7
...
14
...
Also, because of the possible round-off error inherent in floating-point arithmetic, using floating-point numbers in a case selector is discouraged
...
If you try to type in a floating point value into the Case selector, it will display in red
...
You can add, duplicate, or remove cases
...
The Make This The Default Case option in the menu specifies a particular case to execute if the selector value is not listed in the Case structure
...
You must specify a default case for a Case structure if it does not contain selectors for every possible selector value (numeric and string cases)
...
vi To use the Case structure
...
If it is, the VI calculates the square root of the number; otherwise, the VI returns a message
...
Open a new VI
...
Build the front panel shown above
...
The Square Root Value indicator displays the square root of the number if Number is positive
...
com Lesson 6 Case and Sequence Structures Block Diagram (This is the True case of the Case structure above
...
Open the block diagram
...
Select a Case structure (Structures palette) and enlarge it in the block diagram by dragging the mouse
...
It will automatically change to numeric if you wire a numeric control to the terminal
...
To change cases, click on the arrows in the top border of the Case structure
...
Select the other diagram objects and wire them as shown
...
In this exercise, this function checks whether the number input is negative
...
Square Root function (Numeric palette)
...
Numeric Constant (Tunnel shortcut menu)
...
Use the Labeling tool to type in the value into the constant
...
Modify the numeric to have 1 digit of Precision and Floating Point Notation
...
Ensure that a value is wired to the output tunnel from each case
...
In this exercise, this function displays a dialog box that contains the message Error
...
String Constant (String palette)
...
(You will study strings in detail in Lesson 7, Strings and File I/O
...
If the number is greater than or equal to zero, the VI will execute the True case
...
The False case outputs a –99999
...
Negative Number
...
Save the VI
...
vi
...
Return to the front panel and run the VI
...
8
...
End of Exercise 6-1 LabVIEW Basics I Course Manual 6-8 ni
...
You will modify the Temperature Running Average VI to detect when a temperature is out of range
...
You will use this VI later, so be sure to save it as the instructions below describe
...
Open the Temperature Running Average VI
...
Modify the front panel as shown above
...
The Warning LED indicates if the temperature exceeds this limit
...
3
...
vi
...
Modify the block diagram as shown above
...
In this exercise, this function returns a TRUE if the temperature measured exceeds the temperature you specify in the High Limit control; otherwise, the function returns a FALSE
...
In this exercise, this VI sounds a beep if the selection terminal of the Case structure receives a TRUE
...
Notice that there are no icons in the False case of the Case structure
...
If the temperature is less than the set limit, the LED turns off, the VI executes the False case, and there is no beep
...
Save the VI
...
Run the VI
...
When the temperature exceeds 80°, the LED will turn on and a beep will sound
...
Close the VI
...
com Lesson 6 Case and Sequence Structures B
...
You can either enclose nodes with the Sequence structure or drag nodes inside the structure
...
In conventional text-based languages, the program statements execute in the order in which they appear
...
The Sequence structure is LabVIEW’s way of controlling the order in which nodes execute
...
x), the diagram to be executed second is placed inside the border of Frame 1(0
...
(0
...
As with the Case structure, only one frame is visible at a time
...
You create sequence locals on the border of a frame
...
The data, however, is not available in frames preceding the frame in which you created the sequence local
...
A sequence local in Frame 1 passes the value that the Thermometer VI returns
...
Keep in mind that the VI displays only one sequence at a time
...
com Lesson 6 Exercise 6-3 Objective: Case and Sequence Structures Time to Match
...
You will build a VI that computes the time it takes to generate a random number that matches a number you specify
...
Front Panel Free Label 1
...
2
...
Be sure to modify the controls and indicators as depicted
...
Use the Save As command to save the VI as Time to Match
...
© National Instruments Corporation 6-13 LabVIEW Basics I Course Manual Lesson 6 Case and Sequence Structures Block Diagram 4
...
5
...
6
...
Return to the frame that contains the While Loop, right-click the frame border, and choose Make This Frame»0
...
Build the diagram as shown on the previous page
...
This function reads the current value of the operating system’s software timer and returns the value in milliseconds
...
com Lesson 6 Case and Sequence Structures First, the Tick Count (ms) function reads the operating system’s software clock and returns its value in milliseconds
...
In Frame 1, the Tick Count (ms) function again reads the operating system’s software timer
...
8
...
9
...
Run the VI
...
) 10
...
000, your VI may be running too quickly
...
11
...
End of Exercise 6-3 © National Instruments Corporation 6-15 LabVIEW Basics I Course Manual Lesson 6 Case and Sequence Structures C
...
You can enter equations into the formula node by using the Labeling tool
...
This feature is extremely useful when the function equation has many variables or is otherwise complicated
...
If you implement this equation using regular LabVIEW arithmetic functions, the block diagram looks like the one shown below
...
Note semicolon With the Formula Node, you can directly enter a multivariable equation, or formulas, instead of creating block diagram subsections
...
You enter the formula or formulas inside the box
...
LabVIEW Basics I Course Manual 6-16 ni
...
Use the LabVIEW Help (Help»Contents and Index) for a complete listing of functions, operations, and syntax for the Formula Node
...
Consider the following code fragment that computes the square root of x if x is positive, and assigns the result to y
...
if (x >= 0) then y = sqrt(x) else y = -99 end if You can implement the code fragment using a Formula Node, as shown below
...
Refer to the LabVIEW Help for more information
...
vi To use the Formula Node
...
Front Panel 1
...
2
...
The Graph indicator will display the plot of the equation y = f(x)^3 + f(x), where f(x) = tanh(x) + cos(x)
...
com Lesson 6 Case and Sequence Structures Block Diagram 3
...
Formula Node (Structures palette)
...
Create the X input terminal by right-clicking the border and choosing Add Input from the shortcut menu
...
You must also add an output the intermediate (“dummy”) variable a as an output
...
The names are case sensitive—if you use a lower case “x” to name the terminal, you must use a lower case “x” in the formula
...
Numeric Constant (Numeric palette)
...
Divide function (Numeric palette)
...
0
...
0
...
The VI then stores the result in an array at the For Loop border (auto-indexing)
...
4
...
Name it Formula Node Exercise
...
5
...
6
...
End of Exercise 6-4 © National Instruments Corporation 6-19 LabVIEW Basics I Course Manual Lesson 6 Case and Sequence Structures D
...
For example, a VI used in a test system may have a “status” indicator that displays the name of the current test or process in progress
...
" You cannot use the “status” indicator as shown above because according to the data flow paradigm, nothing leaves a node until the node finishes running
...
You can use Local variables to solve this problem, but a better solution would be to replace the Sequence structure with a loop and a Case structure
...
Shown below is a new structure that is equivalent to a Sequence structure with three frames, where each case in the Case structure is equivalent to a sequence frame
...
” A front panel string indicator is updated to display the status of the VI for each frame
...
This updates the indicator before the named subVI is called
...
LabVIEW Basics I Course Manual 6-20 ni
...
For example, if an error occurs while running the first test, a False value can be passed to the loop condition to end the loop
...
© National Instruments Corporation 6-21 LabVIEW Basics I Course Manual Lesson 6 Case and Sequence Structures Summary, Tips, and Tricks • • Use the Case structure to branch to different diagrams depending on the input to the selection terminal of the Case structure
...
The case selection can be Boolean (2 cases), string, or numeric (231–1 cases)
...
• If you wire a value out of one case, you must wire something to that tunnel in every case
...
The diagram portion to be executed first is placed in the first frame of the structure, the diagram to be executed second is placed in the second frame, and so on
...
The data passed in a sequence local is available only in frames subsequent to the frame in which you created the sequence local, and not in frames that precede the frame
...
This feature is extremely useful when a function equation has many variables or is complicated
...
• LabVIEW Basics I Course Manual LabVIEW has two structures to control data flow—the Case structure and the Sequence structure
...
Sequence structures can be replaced using a loop and a Case structure
...
6-22 ni
...
y1 = x3 + x2 + 5 y2 = m * x + b Use only one Formula Node for both equations
...
Name the VI Equations
...
6-6 Build a VI that functions like a calculator
...
Use a slide control to specify the operation to be performed
...
vi
...
Name the VI Square Root 2
...
6-8 Build a subVI that has two inputs and one output
...
” Output Array will contain values from Input Array that are greater than Threshold
...
vi
...
5
...
vi
...
com Lesson 7 Strings and File I/O Introduction This lesson introduces LabVIEW strings and file I/O operations
...
How to create string controls and indicators
...
How to use several string functions
...
How to perform file input and output operations
...
How to format text files for use in spreadsheets
...
How to use the high-level File VIs
...
Strings A string is a sequence of displayable or nondisplayable characters
...
For example, in instrument control, you pass numeric data as character strings
...
In many cases, storing numeric data to disk also requires strings, which means that you first must convert numbers to strings before writing the numbers to a file on disk
...
Enter or change text inside a string control using the Operating tool or the Labeling tool
...
To minimize the space that a front panel string control or indicator occupies, use the Show Scrollbar option from the string shortcut menu
...
You also can configure string controls and indicators for different types of display
...
With this option selected, only asterisks appear in the string front panel display
...
String controls and indicators also can display and accept characters that are usually nondisplayable, such as backspaces, carriage returns, tabs, and so on
...
LabVIEW Basics I Course Manual 7-2 ni
...
A partial list of codes appears in the table below
...
) To enter a nondisplayable character into a string control, type the backslash character \, followed by the code for the character
...
Backslash code for the New Line character is entered into a string control, but you cannot see it
...
Code LabVIEW Interpretation \b Backspace (ASCII BS, equivalent to \08) \s Space (ASCII SP, equivalent to \20) \r Return (ASCII CR, equivalent to \0D) \n Newline (ASCII LF, equivalent to \0A) \t Tab (ASCII HT, equivalent to \09) The characters contained in LabVIEW string controls and indicators are represented internally in ASCII format
...
© National Instruments Corporation 7-3 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O B
...
These functions are available from the Functions»String palette
...
String Length returns the number of characters in a string
...
string The_quick_brown_fox_ 20 Length Concatenate Strings concatenates all input strings and arrays of strings into a single output string
...
You can resize the function with the Positioning tool to increase the number of inputs
...
com Lesson 7 Strings and File I/O String Subset returns the substring beginning at offset and containing length number of characters
...
Match Pattern returns the matched substring
...
If no match is found, the match substring is empty and the offset past match is –1
...
The Format Into String function converts a number to a string and the Scan From String function converts a string to a number
...
© National Instruments Corporation 7-5 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Format Into String converts any format argument (for example, numeric) to the specified formatted resulting string
...
The function can format the output string with the initial string and argument(s) based on the format string
...
28 to the 6-byte string “1
...
” Scan From String converts a string containing valid numeric characters (0 to 9, +, –, e, E, and period) to a number
...
The function can scan the input string into various data types (for example, numerics or Booleans) based on the format string
...
In the example below, the function converts the string “VOLTS DC+1
...
00
...
(The first character offset is zero
...
00 7-6 ni
...
The format string specifies the format, precision, data type, and width of the converted value
...
After you configure the format string and select Create String, the dialog box creates the string constant and wires it to the format string input for you
...
© National Instruments Corporation 7-7 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Exercise 7-1 Objective: Build String
...
You will build a VI that converts a number to a string and concatenates the string to other strings to form a single output string
...
The VI also matches a pattern in a string and converts the remaining string to a number
...
Front Panel 1
...
2
...
Be sure to modify the controls and indicators as depicted
...
The digital indicator will display the string length
...
The offset value past the match is displayed
...
com Lesson 7 Strings and File I/O Block Diagram 1
...
Format Into String function (String subpalette)
...
To create the format string %
...
From the Edit Format String dialog box, create the format string
...
Place a checkmark in the Use specified precision checkbox and type 4 to convert the number into a string with four digits after the decimal point
...
Select the OK button
...
Concatenate Strings function (String palette)
...
To increase the number of inputs, resize the function using the Positioning tool
...
In this exercise, this function returns the number of characters in the concatenated string
...
In this exercise, this function searches the string input for a colon
...
Scan from String function (String palette)
...
2
...
3
...
vi
...
Type text inside the three string controls and a number inside the digital control
...
5
...
End of Exercise 7-1 LabVIEW Basics I Course Manual 7-10 ni
...
File I/O File input and output (I/O) operations store information to and retrieve information from files on disk
...
All File I/O functions are in the Functions»File I/O palette
...
High-Level File VIs The nine high-level File VIs are in the top row of the File I/O subpalette (see above), which includes a subpalette for Binary File VIs
...
They simplify the most common types of file I/O encountered with LabVIEW by transparently handling lower level functions
...
If a file I/O error occurs during the execution of one of these VIs, a dialog box shows the error
...
They provide substantially more functionality than the high-level VIs, such as programmatic file opening and closing and direct managing of file read and write markers
...
Advanced File I/O Functions The Advanced File Functions are in the Functions»File I/O palette
...
Several of the Advanced File I/O functions are discussed in more detail in the LabVIEW Basics II course
...
This section discusses the Open/Create/Replace File VI, the Read File function, the Write File function, and the Close File function
...
Use the LabVIEW Help, which you can access by selecting Help»Contents and Index to demonstrate and learn more about the details of these functions
...
If you leave file path unwired, the VI displays a file dialog box from which you can choose the new or existing file
...
You can read or write any data type using the Read File and Write File functions
...
We will discuss refnums in the next section
...
LabVIEW Basics I Course Manual 7-12 ni
...
Writing begins at the location specified by the pos offset and pos mode
...
This function closes files of all data types
...
Each Intermediate function has an error in input and an error out output
...
© National Instruments Corporation 7-13 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O When the functions execute, they first check the error in cluster to see if an error has occurred in any preceding VI or function
...
They simply pass the error in information to their error out cluster for the next node
...
Simple Error Handler (Time & Dialog subpalette) checks for errors in the file operations and displays a dialog box if an error occurs
...
With the File VIs, you can write any data type to the file you have opened or created
...
You can access files either programmatically or through a dialog box
...
You can save time by programmatically wiring the filename and pathname to the VI
...
An example is /home/TESTDATA/TEST1
...
DAT, in the directory TESTDATA in the /home directory
...
Macintosh LabVIEW Basics I Course Manual A pathname consists of the drive name, followed by a colon, followed by backslash-separated directory names, followed by the filename
...
DAT for a file named TEST1
...
A pathname consists of the volume name (the name of the disk), followed by a colon, followed by colon-separated folder names, followed by the filename
...
DAT for a file named 7-14 ni
...
DAT, inside a folder named TESTDATA, on a disk called Hard Disk
...
In the above example, the Open/Create/Replace File VI opens the file TEST1
...
The VI also generates a refnum and an error cluster
...
The error cluster is a bundle of data containing error messages generated by previous or upstream VIs
...
Error clusters are discussed further in the LabVIEW Basics II course
...
Because a VI or node cannot execute until it receives all of its inputs, the passing of these two parameters forces the File VIs to execute in order
...
The Close File function closes the file after receiving the error cluster and refnum from Write File
...
Note that if an error occurs in one node, subsequent nodes do not execute and pass the error cluster to the Simple Error Handler VI
...
You also must specify the amount of data to be read
...
” It passes the refnum, the error cluster, and the file size to Read File
...
The Close File function closes the file
...
LabVIEW Basics I Course Manual 7-16 ni
...
vi To write data to a file
...
You will use the subVI created in Exercise 7-1, Build String
...
In the next exercise, you will build a VI to read the file and display its contents
...
Open a new VI and build the front panel shown above
...
The String to Write control will input the message written to the file
...
Create a path indicator from the String and Path palette
...
2
...
© National Instruments Corporation 7-17 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Block Diagram 1
...
The functions are described below
...
The subVI concatenates the three input strings to one combined string
...
This VI displays an interactive file dialog box to open or create a file
...
b
...
Type enter filename (right-click the VI function terminal and select Create»Constant) specifies to create a new file or replace an existing file
...
Write File function (File I/O palette)
...
Close File function (File I/O palette)
...
Simple Error Handler VI (Time & Dialog palette)
...
2
...
Name it File Writer
...
3
...
A dialog box opens and displays the prompt “Enter filename
...
txt in the dialog box and click Save or OK
...
You now will build a VI that opens the file and reads its contents
...
com Lesson 7 Exercise 7-3 Objective: Strings and File I/O File Reader
...
You will build a VI that reads the file created in the previous exercise and displays the information read in a string indicator if the user’s password matches the specified password from the Build String VI
...
Open a new VI and build the front panel shown above
...
2
...
© National Instruments Corporation 7-19 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Block Diagram 1
...
Open/Create/Replace File VI (File I/O palette)
...
a
...
b
...
Read File function (File I/O palette)
...
Close File function (File I/O palette)
...
Simple Error Handler VI (Time & Dialog palette)
...
2
...
Name it File Reader
...
3
...
A dialog box appears
...
txt and click Open or OK
...
End of Exercise 7-3 Challenge Modify the VI so that the number is parsed and displayed in a digital indicator
...
Hint: Use the Match Pattern function to search for the first numeric character
...
com Lesson 7 Strings and File I/O D
...
In many spreadsheets, the tab character separates columns and the end of line character separates rows
...
The Format Into File function combines the functionality of the Format Into String function and the Write File function where it formats the data as specified and writes that data directly to a file
...
Also notice that there are error in and error out terminals you can wire to track error conditions just like the other File I/O functions you have used
...
The file is first opened with the Open/Create/Replace File VI, then a For Loop executes five times
...
After the loop completes five iterations, the file is closed and the error condition is checked
...
4258 ¶ 0
...
9453 ¶ 0
...
9517 ¶ Tab ¶ End of Line LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O The End of Line constant (String palette) behaves differently depending on the platform
...
Note Windows The End of Line constant inserts a carriage return character and a line feed character
...
Macintosh End of Line constant The End of Line constant inserts a carriage return character
...
com Lesson 7 Exercise 7-4 Objective: Strings and File I/O Temperature Logger
...
You will modify the Temperature Control VI to save the time and current temperature to a data file
...
Front Panel 1
...
The front panel already is built
...
2
...
vi
...
Build the diagram shown above
...
This VI displays an interactive file dialog box that you use to create the new file or replace an existing one
...
Right-click on the VI prompt terminal and select Create Constant
...
Right-click, select Create Constant, and use the Operating tool to change the value
...
End of Line constant (String palette)
...
This function returns the time, in string format, when the temperature measurement was taken
...
True Boolean Format Into File function (File I/O palette)
...
Resize the function to have four argument terminals
...
com Lesson 7 Strings and File I/O Unbundle by Name function (Cluster palette)
...
Not function (Boolean palette)
...
The Not and And functions control the While Loop condition such that the loop continues while the Power switch is True and there is no error
...
This function closes the file
...
This VI checks the error cluster and displays a dialog box if an error occurred
...
Save the VI
...
Run the VI
...
Type temp
...
The VI creates a file called temp
...
The VI then takes readings every half-second and saves the time and temperature data to a file until you press the Power switch or an error occurs
...
4
...
You now can use a word processor or spreadsheet to open the file you created
...
Start the WordPad or NotePad application or another word processor or a spreadsheet
...
txt
...
Run the Text Editor application
...
txt
...
Switch to the Finder and launch TeachText or another word processor or a spreadsheet
...
txt
...
After you load the file into the word processor or spreadsheet, notice that the time appears in the first column and the temperature data appears in the second column
...
End of Exercise 7-4 © National Instruments Corporation 7-25 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O E
...
These VIs transparently handle file opening and closing, and the spreadsheet file I/O VIs convert numeric array data from and to spreadsheet string format as they read from and write to disk
...
The VIs are located on the Functions»File I/O palette
...
Use the Help»Contents and Index to demonstrate/learn more about these functions
...
The VI opens or creates the file before writing the file and closes it afterwards
...
The VI opens the file before reading to a file and closes it afterwards
...
You can optionally transpose the data
...
The VI creates a text file most spreadsheet programs can read
...
com Lesson 7 Strings and File I/O Read From Spreadsheet File reads a specified number of lines or rows from a numeric text file beginning at a specified character offset and converts the data to a 2D single-precision array of numbers
...
You can use this VI to read a spreadsheet file saved in text format
...
The VI opens the file before reading the file and closes it afterwards
...
Data can be of integer type ([I16]) or floating point ([SGL])
...
© National Instruments Corporation 7-27 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Tables A table is a front panel control used to pass or display data in tabular form
...
The table shown below has three rows and seven columns
...
Column headers Row headers Creating Table Controls and Indicators You create the table control or indicator by selecting Table from the List & Table subpalette of the Controls palette
...
You define cells within the table by clicking inside a cell with either the Operating tool or the Labeling tool
...
The table indicator, or control, is a 2D array of strings
...
The row and column headers are not automatically displayed as in a spreadsheet
...
The example below displays the 3x7 table of random numbers shown above
...
com Lesson 7 Strings and File I/O The example uses a property node to write values in the row and column header
...
© National Instruments Corporation 7-29 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Exercise 7-5 Objective: Spreadsheet Example
...
In the previous exercise, you formatted the string so that tabs separated the columns and end of lines separated the rows
...
Front Panel 1
...
The VI is already built
...
Run the VI
...
The first column contains data for a sine waveform, the second column contains data for a noisy waveform, and the third column contains data for a cosine waveform
...
After the VI displays and plots the data, it displays a dialog box for the filename
...
txt and click OK or Save
...
LabVIEW Basics I Course Manual 7-30 ni
...
Open the block diagram to examine it
...
In this exercise, this VI returns a numeric array of 128 elements containing a sine pattern
...
Uniform White Noise (Analyze»Signal Processing»Signal Generation palette)
...
Cosine Array
...
...
...
Sine Array Noise Array
...
...
In this exercise, this function builds a 2D array from the sine array, noise array, and cosine array
...
This function rearranges the elements of the 2D array so that element [i,j] becomes element [j,i], as shown below: Sine Array Noise Array Cosine Array Sine Array Cosine Array
...
...
...
...
...
This VI formats the 2D array that Build Array creates into a spreadsheet string, and writes the string to a file
...
...
...
...
...
¶ ¶ ¶ Tab ¶ End of Line ¶ Number To Fractional String function (String»String/Number Conversion palette)
...
The format string specifies the string to be in the 2-precision fractional format
...
Close the VI
...
To include more arrays, you can increase the number of inputs to the Build Array function
...
Windows 3
...
4
...
txt and observe that the sine waveform data appears in the first column, the random waveform data appears in the second column, and the cosine waveform data appears in the third column
...
Exit the word processor and return to LabVIEW
...
Run the Text Editor application
...
Find and open the file wave
...
5
...
LabVIEW Basics I Course Manual 7-32 ni
...
Switch to the Finder and launch TeachText (or any word processor or spreadsheet) by double-clicking on its icon
...
Find and open the file wave
...
5
...
End of Exercise 7-5 © National Instruments Corporation 7-33 LabVIEW Basics I Course Manual Lesson 7 Strings and File I/O Exercise 7-6 Challenge Temperature Application
...
Your objective is to create a VI that does the following: 1
...
2
...
3
...
4
...
The VI should log data so that each item appears in one column of a spreadsheet
...
5
...
Hint: Start with the Temperature Logger VI you built in Exercise 7-4
...
Save your VI as Temperature Application
...
LabVIEW Basics I Course Manual 7-34 ni
...
Log your data as shown below in the example spreadsheet
...
Write the header to the file before logging data
...
These functions are in the String subpalette of the Functions palette
...
• The string formatting function Scan From String converts ASCII data to numeric format
...
Right-click on the function and select Edit Format String
...
• The File I/O functions are organized into three levels of hierarchy—High-Level, Intermediate, and Advanced
...
Similarly, when you read from a file, you open an existing file, read the data, and close the file
...
• LabVIEW Basics I Course Manual A string is a collection of ASCII characters
...
A spreadsheet file is a special type of text file where a tab character separates data columns and an end of line character separates data rows
...
com Lesson 7 Strings and File I/O Additional Exercises 7-7 Challenge Build a VI that generates a 2D array of 3 rows × 100 columns of random numbers and writes the data transposed to a spreadsheet file
...
Use the high-level File VIs from the File I/O subpalette for this exercise
...
vi
...
Header
...
...
That is, a spreadsheet string with columns separated by commas and rows separated by ends-of-line
...
Save the VI as Spreadsheet Converter
...
Hint: Use the Search and Replace String function
...
The VI should append the data to the end of the existing file, temp
...
Run the VI several times and then use a word processor to confirm that the VI appended new temperature readings
...
vi
...
Use the pos mode and pos offset parameters of the Write File function to move the current file mark
...
com Lesson 8 Data Acquisition and Waveforms Introduction This lesson introduces the use of plug-in data acquisition (DAQ) boards and associated LabVIEW software
...
About plug-in DAQ boards
...
About the organization of the DAQ VIs
...
How to perform a single analog input
...
About DAQ Wizards E
...
F
...
G
...
H
...
I
...
J
...
© National Instruments Corporation 8-1 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms A
...
Often, one board can do a variety of functions—analog-to-digital (A/D) conversion, digital-to-analog (D/A) conversion, digital input/output (I/O), and counter/timer operations
...
Also, each DAQ board is designed for specific hardware platforms and operating systems
...
Data Acquisition System Components al g gn in Si ition d n ed ion dit ls onigna CS Co SCX I-100 1 SCXI 1140 SCXI 1140 SCXI 1140 SCXI 1140 SCX MAINFR I AME -In d ug ar Pl Bo AQ D s r ce u sd an Tr e ar ftw So Option A Parallel Port Link SCX I-100 1 SCXI 1140 SCXI 1140 SCXI 1140 SCXI 1140 e ar SCX SCXI MAINFR 1140 I ftw AME So Data Acquisition and Control Module Option B The fundamental task of a DAQ system is the measurement or generation of real-world physical signals
...
Often, the plug-in DAQ board is considered to be the entire DAQ system; however, the board is only one of the system components
...
A signal LabVIEW Basics I Course Manual 8-2 ni
...
Finally, software controls the DAQ system—acquiring the raw data, analyzing the data, and presenting the results
...
In Option A, the plug-in DAQ board resides in the computer
...
In Option B, the DAQ board is external to the computer
...
The computer and DAQ module communicate through various buses, such as the parallel port, USB, or PCMCIA
...
Analog Input When measuring analog signals with a DAQ board, you must consider the following factors that affect the digitized signal quality: mode (single-ended and differential inputs), resolution, range, sampling rate, accuracy, and noise
...
Use these inputs when the input signals are high level (greater than 1 V), the leads from the signal source to the analog input hardware are short (less than 15 ft
...
If the signals do not meet these criteria, use differential inputs
...
Differential inputs also reduce or eliminate noise errors because the common-mode noise picked up by the leads is canceled out
...
The higher the resolution, the higher the number of divisions into which the range is broken, and therefore, the smaller the detectable voltage change
...
For example, a 3-bit converter divides the range into 23 or 8 divisions
...
Clearly, the digital signal is not a good representation of the original signal because information has been lost in the conversion
...
© National Instruments Corporation 8-3 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Range refers to the minimum and maximum voltage levels that the ADC can quantize
...
Gain refers to any amplification or attenuation of a signal that may occur before the signal is digitized
...
For example, using a 3-bit ADC and a range setting of 0 to 10 V, the figure below shows the effects of applying gain to a signal that fluctuates between 0 and 5 V
...
By amplifying the signal with a gain of two before digitizing, the ADC now uses all eight digital divisions, and the digital representation is much more accurate
...
LabVIEW Basics I Course Manual 8-4 ni
...
This change in voltage represents 1 least significant bit (LSB) of the digital value and is often called the code width
...
For example, a 12-bit DAQ board with a 0 to 10 V input range and a gain of 1 detects a 2
...
8 mV
...
4 mV resolution 12 gain × 2 1×2 20 --------------- = 4
...
A fast sampling rate acquires more points in a given time and therefore can often form a better representation of the original signal than a slow sampling rate
...
Sampling too slowly may result in a poor representation of your analog signal
...
This misrepresentation of a signal, called an alias, makes it appear as though the signal has a different frequency than it truly does
...
For example, audio signals converted to electrical signals often have frequency components up to 20 kHz; therefore, you need a board with a sampling rate greater than 40 kHz to properly acquire the signal
...
Therefore, a board with a slower sampling rate can acquire temperature signals properly
...
Unwanted noise distorts the analog signal before it is converted to a digital signal
...
You can limit external noise error by using proper signal conditioning
...
The level of noise is reduced by a factor of: number of points averaged For example, if you average 100 points, the effect of the noise in the signal is reduced by a factor of 10
...
The boards have been configured for the machines in the class
...
Windows This section describes the setup for the PCI, PCMCIA, or ISA bus computer
...
LabVIEW for Windows DAQ VIs access the National Instruments standard NI-DAQ for Windows 32-bit dynamic link library (DLL)
...
NI-DAQ for Windows supports all National Instruments DAQ boards and SCXI
...
dll file, the high-level interface to your board, is loaded into the Windows\System directory
...
dll file then interfaces with the Windows Registry to obtain the configuration parameters defined by Measurement & Automation Explorer
...
LabVIEW Basics I Course Manual 8-6 ni
...
If you have a Plug & Play (PnP) board, such as an E-Series MIO board, the Windows Configuration Manager automatically detects and configures the board
...
You can check the Windows Configuration by accessing the Device Manager, available by selecting Start»Settings»Control Panel» System»Device Manager
...
Highlight a DAQ board and select Properties or double-click on the board, and you see a dialog window with tabbed pages
...
Resources specifies the system resources to the board such as interrupt levels, DMA, and base address for software configurable boards
...
Driver specifies the driver version and location for the DAQ board
...
After installing a DAQ board in your computer, you must run this configuration utility
...
Use the device number to refer to the board in LabVIEW
...
The figure below shows the primary Measurement & Automation Explorer window
...
1: AT-MIO-64E-3 Notice that Measurement & Automation Explorer detected all the National Instruments hardware including the GPIB board
...
The board parameters that you can set using the configuration utility depend on the board
...
The plug and play capability of Windows automatically detects and configures switchless DAQ boards, such as the PCI-MIO-16XE-50 or a DAQCard
...
LabVIEW Basics I Course Manual 8-8 ni
...
You use the NI-DAQ Configuration utility to configure your DAQ board and accessories
...
9 if you have an NB or a Lab Series board
...
0 or later for the PCI and DAQCard boards
...
You also will test the board interactively with the utility and add three virtual channels
...
The test routines in Measurement & Automation Explorer confirm operation of your board
...
Part I: Examining the DAQ Board Settings 1
...
The utility will briefly examine your system to determine the National Instruments hardware installed, and then display the information
...
On the Macintosh, the NI-DAQ configuration utility will be in a separate folder on your hard drive
...
Open the Devices and Interfaces section
...
LabVIEW Basics I Course Manual 8-10 ni
...
Note the Device number indicated in the parentheses after the DAQ board
...
You may have a different board installed and some of the options shown may be different
...
Note 3
...
With the DAQ board highlighted, click the Properties button just below the menu
...
© National Instruments Corporation 8-11 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms This window contains several tabs
...
Use the remaining tabs to configure the various analog input, output, and accessory parameters for the DAQ board
...
4
...
This tests the system resources assigned to the board according to the Windows Device Manager
...
Part 2: Testing the DAQ Board Components 5
...
Click the Test Panel button
...
LabVIEW Basics I Course Manual 8-12 ni
...
The Test Panel dialog box allows you to test a specific board in several different areas
...
Remember that Channel 0 is connected to the temperature sensor on the DAQ Signal Accessory
...
You can also move the Noise switch to On to see the signal change in this window
...
Click the Analog Output tab, shown below
...
For this exercise, change the Output Mode to Sine Generator and then press the Start Sine Generator button
...
8
...
9
...
You should now see the sine wave from analog output channel 0 on the graphical display
...
com Lesson 8 Data Acquisition and Waveforms 10
...
To verify counter/timer operation, change the Counter Mode to Simple Event Counting and then click the Start button
...
Click Reset to stop the counter test
...
Click the Digital I/O tab, shown below, which you can use to test the digital lines on the DAQ board
...
As you toggle the boxes, the LEDs on the DAQ signal accessory should turn on or off
...
Click the Close button to close the Test Panel and return to the Measurement & Automation Explorer configuration screen
...
12
...
Select Virtual Channel and click the Finish button
...
You will now configure a channel to take a reading from the temperature sensor (Analog Input Channel 0) on the DAQ Signal Accessory
...
Enter the following information into the panels that appear
...
Type of Sensor: LabVIEW Basics I Course Manual Voltage and place a checkmark in the checkbox that says This will be a temperature measurement
...
com Lesson 8 Units: Deg C Range: Leave at default values Scale: New Custom Scale Scale Name: tempscale Scale Description: V * 100 = deg C Scale Type: Data Acquisition and Waveforms Linear m = 100
...
0 DAQ Hardware used: Dev1 (your DAQ board) Channel: 0 Analog Input Mode: Differential 15
...
Select Virtual Channel and press the Finish button
...
Type of Sensor: Voltage Units: V Range: –10
...
0 V Scale: No Scaling DAQ Hardware used: Dev1 (your DAQ board) Channel: 1 Analog Input Mode: Differential 16
...
The Copy Virtual Channel dialog box appears; leave the values at default and click the OK button
...
Verify these settings and update the description by right-clicking chan2 and selecting Properties
...
The Measurement & Automation Explorer window should resemble the following figure when you are finished and all the categories are expanded: 18
...
End of Exercise 8-1 LabVIEW Basics I Course Manual 8-18 ni
...
Data Acquisition VI Organization The LabVIEW DAQ VIs are organized into subpalettes corresponding to the type of operation involved—analog input, analog output, counter operations, or digital I/O
...
Under this subpalette, the DAQ VIs are organized into six subpalettes: Analog Input, Analog Output, Digital I/O, Counter, Calibration and Configuration, and Signal Conditioning
...
The Analog Input subpalette below shows this organization
...
There are also two subpalettes in this menu: one for access to the Analog Input Utility VIs and one for the Advanced Analog Input VIs
...
The Advanced VIs are beyond the scope of this course
...
They are ideal for simple DAQ, digital I/O, or counter/timer tasks or for getting started with DAQ in LabVIEW
...
When a DAQ error occurs in your VI, a dialog box shows error information
...
Intermediate VIs Compared to the Easy I/O VIs, the Intermediate VIs have more hardware functionality, flexibility, and efficiency for developing your application
...
As you become acquainted with LabVIEW, you will discover that the Intermediate VIs are better suited for most of your applications
...
With each VI, you can pass error status information to other VIs and handle errors programmatically
...
Few applications require the Advanced VIs; the Easy I/O and Intermediate VIs will suffice for most DAQ applications
...
They are for situations where you need more functionality control than the Easy I/O VIs provide, but want to limit the number of VIs you call
...
com Lesson 8 Data Acquisition and Waveforms C
...
To acquire a single point from your signal connected to your DAQ board, use AI Sample Channel
...
Device is the device number of the DAQ board
...
High limit and low limit specify the range of the input signal
...
If an error occurs during the operation of AI Sample Channel, a dialog box displays the error code, and you have the option to abort the operation or continue execution
...
AI Sample Channels measures the signals attached to multiple channels and returns those measured values in an array
...
Channels specifies from which analog input channels to read
...
The default inputs are +10 V and –10 V, respectively
...
The order of the values in the samples array matches the order requested in the DAQ Channel Name control
...
If an error occurs during the operation of AI Sample Channels, a dialog box displays the error code, and you have the option to abort the operation or continue execution
...
You select the DAQ Channel Name control from the I/O subpalette of the Controls palette as shown below
...
You can use the Operating tool to click on the DAQ Channel Name control and choose the channel name as defined in the MAX utility as shown below
...
com Lesson 8 Data Acquisition and Waveforms Another method is to right-click on the DAQ Channel Name control and select the Allow Undefined Names option, as shown below
...
You will now create a VI that acquires data from an analog input channel on the DAQ board and displays that value in a meter
...
vi To acquire an analog signal using a DAQ board
...
The temperature sensor outputs a voltage proportional to the temperature
...
You will use this VI later, so be sure to save it as the instructions below describe
...
Open a new VI
...
Build the front panel shown above
...
The DAQ Channel Name control specifies the channel on the DAQ board
...
3
...
0 to 0
...
To do this, double-click on 10
...
4
...
) LabVIEW Basics I Course Manual 8-24 ni
...
Build the diagram shown above
...
In this exercise, this VI reads an analog input channel and returns the voltage
...
Right-click on the channel terminal and select Create»Control
...
In this exercise, this function causes the loop to execute every 100 ms
...
This VI simulates a reading from an analog input channel
...
Save the VI as Voltmeter
...
3
...
The meter should display the voltage that the temperature sensor outputs
...
If an error occurs, the Easy I/O VIs automatically display a dialog box showing the error code and a description of the error
...
Click on the DAQ Channel Name control with the Operating tool and select temp
...
Change the meter scale to see the correct values
...
Close the VI
...
End of Exercise 8-2 © National Instruments Corporation 8-25 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Exercise 8-3 Objective: Measurement Averaging
...
1
...
The VI measures the voltage output from the temperature sensor once per second and plots it on the waveform chart
...
This VI simulates a reading from analog input Channel 0
...
Introduce noise into the temperature measurement by flipping the switch labeled Temp Sensor Noise on the DAQ Signal Accessory to the ON position
...
3
...
Modify the True case inside the block diagram to take 30 measurements, average the data, and plot the average of the 30 measurements
...
Run the VI
...
5
...
End of Exercise 8-3 LabVIEW Basics I Course Manual 8-26 ni
...
The DAQ Wizards LabVIEW contains several wizards to help you develop your applications faster
...
It works with analog input and output, digital I/O, and counter/timers
...
An example VI is created that you can save to a new location
...
When you press the Go to DAQ Channel Wizard button, the MAX utility opens
...
You can then reference the channel name for the input signal throughout the application, and all of the conversion processes are performed transparently
...
© National Instruments Corporation 8-27 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Exercise 8-4 Objective: Simple Data Logger
...
You will use the DAQ Solution Wizard to create a VI that acquires several channels of data, shows that data in a strip chart, and logs that data to file
...
For this exercise, connect the sine wave output to Analog In CH1 and the square wave output to Analog In CH2 on the DAQ Signal Accessory
...
Open a new VI
...
Launch the DAQ Solution Wizard by selecting DAQ Solution Wizard from the Tools»Data Acquisition menu in LabVIEW
...
You will be using these channels for this exercise—temp, chan1, and chan2
...
You can look at these channel definitions in more detail by launching the DAQ Channel Wizard by clicking on the Go to DAQ Channel Wizard button
...
com Lesson 8 Data Acquisition and Waveforms 3
...
Here you have the option to either make a custom application or view the VIs in the Common Solutions Gallery
...
Select Solutions Gallery and press the Next button to get the following window: © National Instruments Corporation 8-29 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms 5
...
When you press the Next button, you will be asked which channels of data to log
...
Click on the Open Solution button to get the following panel
...
com Lesson 8 Data Acquisition and Waveforms Front Panel 7
...
Open and examine the diagram
...
Both of these are high-level I/O VIs, and a dialog box will open if an error occurs
...
Return to the panel, set the Time Between Points to be 1 sec, and run the VI
...
Create the file called logger
...
9
...
End of Exercise 8-4 © National Instruments Corporation 8-31 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms E
...
In addition, it is difficult to attain a constant sample interval between each point because the interval depends on a number of factors: loop execution speed, call software overhead, and so on
...
Furthermore, the VIs can accept user-specified sampling rates
...
AI Acquire Waveform acquires the specified number of samples at the specified sample rate from a single input channel and returns the acquired data
...
Channel specifies the analog input channel number
...
Sample rate is number of samples to acquire per second
...
The default inputs are +10 V and –10 V, respectively
...
Waveform Data The DAQ VIs return waveform data
...
You can place a waveform on the panel by selecting it from the I/O subpalette of the Controls palette as shown below: LabVIEW Basics I Course Manual 8-32 ni
...
You can also wire the waveform datatype directly to a waveform graph, and it will properly scale the X axis with the time data, as shown in the following figure
...
© National Instruments Corporation 8-33 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Exercise 8-5 Objective: Acquire Waveform
...
You will build a VI that uses the DAQ VIs to acquire a signal and plot it on a graph
...
Front Panel 1
...
The # of Samples control specifies the number of points to sample
...
The DAQ Channel Name control and Waveform indicator are both in the I/O subpalette
...
com Lesson 8 Data Acquisition and Waveforms Block Diagram 2
...
AI Acquire Waveform VI (Data Acquisition»Analog Input subpalette)
...
Note If you do not have a DAQ board or a DAQ Signal Accessory, use the following VI in place of the AI Acquire Waveform VI: (Demo) Acquire Waveform VI (User Libraries»Basics I Course subpalette)
...
3
...
vi
...
Return to the front panel, enter values for the controls, and run the VI
...
Try different values for the sampling rate and the number of samples
...
Leave this VI open when you are finished, as you will use it in the next exercise
...
Writing Waveform Data to File There are several ways you can write waveform data to a file
...
The Write Waveforms to File and Read Waveforms from File VIs write data in a special LabVIEW binary data file called a datalog file
...
You use the Export Waveforms to Spreadsheet File VI to write the waveform data to a spreadsheet format
...
com Lesson 8 Data Acquisition and Waveforms The Export Waveforms to Spreadsheet File VI does an operation similar to the high-level Write to Spreadsheet File VI
...
You wire the waveform directly to the input, and this VI converts the data to spreadsheet format using a Tab delimiter as the default
...
You can also add a header to the file or write multiple time columns to the file
...
The error in and error out clusters track the error conditions
...
© National Instruments Corporation 8-37 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Exercise 8-6 Objective: Acquire Waveform to File
...
You modify the previous VI that acquires data from an analog input channel on the DAQ board to write the data to a file in spreadsheet format
...
Open the Acquire Waveform VI that you built in the previous exercise if it is not already open
...
Rename the VI Acquire Waveform to File
...
3
...
Switch to the block diagram
...
Build the block diagram shown above
...
Opens a file, formats and writes waveform data to file with a header, and closes the file
...
This VI checks the error cluster and displays a dialog box if an error occurred
...
Save the VI
...
Return to the front panel and run the VI
...
Type acquire
...
7
...
txt file
...
It describes the starting time and time increment values
...
8
...
End of Exercise 8-6 LabVIEW Basics I Course Manual 8-38 ni
...
Scanning Multiple Analog Input Channels With the Analog Input Easy I/O AI Acquire Waveforms VI, you can acquire waveforms from several channels in a single run
...
Device is the device number of the DAQ board
...
A comma separates the channels in the string—for example, 1, 2, 4
...
Scan rate is number of samples to acquire per second for each channel
...
The default inputs are +10 V and –10 V, respectively
...
The next two examples show the AI Acquire Waveforms VI for a four-channel scan
...
For each channel, 100 samples are acquired at 2,000 Hz
...
The data for the first channel is stored in element 0, the second channel in element 1, and so on
...
© National Instruments Corporation 8-39 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Scanned Waveforms and Graphs You can directly wire the output of the AI Acquire Waveforms VI to a waveform graph for plotting
...
LabVIEW Basics I Course Manual 8-40 ni
...
vi To use the Easy I/O VIs to perform a scanned data acquisition
...
For this exercise, connect the sine wave output to Analog In CH1 and the square wave output to Analog In CH2 on the DAQ Signal Accessory
...
Open the Scan Example VI
...
Study the block diagram
...
In this exercise, this VI simulates reading a sine wave on Channel 1 and a square wave on Channel 2
...
Run the VI
...
4
...
Do not save any changes
...
vi (Optional) To acquire data from multiple channels on the DAQ board and display them on one graph
...
Create a VI that scans data from Channel 1 and Channel 2 and plots both waveforms on a single waveform graph
...
The VI also should write the scanned data to a spreadsheet file so that when the file is opened using a spreadsheet, each channel is displayed in a column
...
In this exercise, this VI simulates reading a sine wave on Channel 1 and a square wave on Channel 2
...
vi
...
End of Exercise 8-8 LabVIEW Basics I Course Manual 8-42 ni
...
Analog Output The Analog Output library contains VIs that perform digital-to-analog (D/A) conversions or multiple conversions
...
Device is the device number of the DAQ board
...
Value is the voltage to be output
...
Waveform Generation In many applications, generating one point at a time may not be fast enough
...
With the AO Generate Waveform VI, you can generate multiple points at rates greater than the AO Update Channel VI can achieve
...
AO Generate Waveform generates a voltage waveform on an analog output channel at the specified update rate
...
Channel specifies the analog output channel name
...
Waveform contains data to be written to the analog output channel in volts
...
vi To output an analog voltage using a DAQ board
...
5 V in 0
...
You will measure the voltage output using the Voltmeter VI that you created in Exercise 9-2
...
Front Panel 1
...
The VI already is built
...
The Voltage Out indicator displays the current voltage output
...
Open the block diagram
...
Examine the block diagram
...
In this exercise, this VI outputs the specified voltage using analog output channel 0
...
LabVIEW Basics I Course Manual 8-44 ni
...
In this exercise, this VI simulates generating a voltage on an analog output channel
...
In this exercise, this function multiplies “i” by 0
...
Wait Until Next ms Multiple function (Time & Dialog subpalette)
...
Local Variable (right-click on the Voltage Out terminal and select Create»Local Variable)
...
0 to the Voltage Out indicator after the For Loop completes
...
The LabVIEW Basics II course covers local variables
...
The AO Update Channel VI outputs the voltage in 0
...
5 V
...
A local variable writes a 0
...
4
...
5
...
0 to 10
...
6
...
Set the limit controls as shown below
...
7
...
8
...
Run the Voltage Output Example VI
...
Observe the front panel of the Voltmeter VI
...
© National Instruments Corporation 8-45 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms 9
...
End of Exercise 8-9 LabVIEW Basics I Course Manual 8-46 ni
...
Digital Input and Output The data acquisition Data Acquisition»Digital I/O library contains VIs to read from or write to an entire digital port or to a specified line of that port
...
Device is the device number of the DAQ board
...
Line specifies the digital line to write to
...
Read from Digital Line reads the logical state of a digital line on a user-configured port
...
Digital Channel specifies the port where the line is located
...
Line State returns the logical state of the given line
...
Device is the device number of the DAQ board
...
Pattern specifies the new state of the lines to be written to the port
...
© National Instruments Corporation 8-47 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Read from Digital Port reads a user-configured port
...
Digital Channel specifies the digital port to read
...
Port Width specifies the total number of bits in the port
...
LabVIEW Basics I Course Manual 8-48 ni
...
vi Objective: To control the digital I/O lines on the DAQ board
...
Each LED is wired to a digital line on the DAQ board
...
Note The LEDs use negative logic
...
Writing a zero to the LED digital line turns on the LED
...
Open the Digital Example VI
...
2
...
3
...
Enter different numbers between 0 and 15 inside the Pattern Input control
...
4
...
Do not save any changes
...
Buffered Data Acquisition (Optional) A common application for data acquisition is performing buffered or continuous acquisition
...
Intermediate VIs Compared to the Easy I/O VIs, the Intermediate VIs have more hardware functionality, flexibility, and efficiency for developing your application
...
The second tier of the Data Acquisition»Analog Input subpalette consists of the Intermediate Analog Input VIs
...
Use the LabVIEW online reference (Help»Contents and Index menu) to demonstrate and learn more about the details of these functions
...
Note Intermediate VIs The following figure shows how to use the Intermediate Analog Input VIs in your block diagram
...
The figures are presented to demonstrate the order of execution of the VIs and the use of the taskID to control data flow
...
The block diagram calls AI Config, AI Start, AI Read, AI Clear, and Simple Error Handler
...
AI Start programs the counters on the DAQ board and starts the data acquisition
...
AI Clear frees computer and DAQ board resources
...
com Lesson 8 Data Acquisition and Waveforms error cluster propagates through the VIs and Simple Error Handler displays a dialog box if an error occurs
...
The number of scans to acquire parameter of AI Start is left unwired and has a default input of –1
...
Similarly, the number of scans to read parameter of AI Read is also unwired and has a default input of –1
...
Continuous Data Acquisition Continuous, or real-time, data acquisition returns data from an acquisition in progress without interrupting the acquisition
...
You specify the size of a large circular buffer when you configure the acquisition
...
LabVIEW transfers data out of the buffer one block at a time for graphing and storing to disk
...
This process continues until the system acquires the specified number of samples, LabVIEW clears the operation, or an error occurs
...
© National Instruments Corporation 8-51 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms a
...
End of Data Incoming Board Data Current Read Mark Buffer Size c
...
End of Data Current Read Mark > > > You configure LabVIEW for continuous data acquisition by instructing AI Start to acquire data indefinitely
...
The following figure illustrates a typical continuous DAQ block diagram
...
AI Read is called in a looping structure to retrieve data from the buffer
...
AI Clear halts the acquisition, deallocates the buffers, and frees any board resources
...
com Lesson 8 Data Acquisition and Waveforms Exercise 8-11 Continuous Acquire with MIO
...
To build a VI that performs a continuous acquisition operation and plots the most recently acquired data on a chart
...
Open a new VI
...
Build the front panel shown above by following the instructions below
...
You can create most of the front panel controls shown above from the block diagram by right-clicking on the appropriate terminals of the DAQ VIs and selecting Create»Control
...
In this exercise, you will acquire data from multiple channels of the DAQ Signal Accessory and display the data on the graph
...
Set the channel string control input to 0,1,2 or 0:2
...
Before running this exercise, make the following connections on the DAQ Signal Accessory
...
Connect the square wave output to analog input CH2
...
Build the block diagram as shown above
...
In this exercise, this VI configures the analog input operation for a specified set of channels, configures the hardware, and allocates a buffer in computer memory
...
In this exercise, this VI starts the continuous buffered analog input operation and sets the rate at which to acquire data
...
In this exercise, this VI reads data from the buffer allocated by AI Config
...
AI Clear VI (Data Acquisition»Analog Input subpalette)
...
Simple Error Handler VI (Time and Dialog subpalette)
...
Unbundle by Name function (Cluster subpalette)
...
4
...
Name it Continuous Acquire with MIO
...
5
...
Run the VI and monitor the data plotted on the graph as you change the frequency knob on the DAQ Signal Accessory
...
Data fills a buffer of fixed size in memory and then, on reaching the end of the buffer, overwrites values from the beginning of the buffer
...
com Lesson 8 Data Acquisition and Waveforms 6
...
” Run the VI and monitor the Scan Backlog indicator as you decrease the scan rate or the number of scans to read at a time
...
Scan backlog is a measure of how well you are keeping up with a continuous acquisition
...
If this happens, AI Read returns an error
...
Close the VI
...
• This lesson discussed the LabVIEW Easy I/O and Intermediate DAQ VIs
...
They are ideal for simple analog I/O or digital tasks or for getting started with DAQ in LabVIEW
...
When a DAQ error occurs in your VI, error information appears in a dialog box
...
• Compared to the Easy I/O VIs, the Intermediate VIs feature more hardware functionality, flexibility, and efficiency for developing your application
...
• You can use waveform acquisition or generation to acquire or generate data faster and at a more constant sampling rate than the single point conversions
...
• LabVIEW Basics I Course Manual You can access the DAQ VIs by choosing the Data Acquisition subpalette from the Functions palette
...
The DAQ VIs return data as a waveform
...
You wire a waveform directly to a waveform graph, and the X and Y scales automatically adjust to the data
...
com Lesson 8 Data Acquisition and Waveforms Additional Exercise 8-12 Build a VI that continuously measures temperature twice per second and displays the temperature on a waveform chart
...
The LEDs on the box are labeled
...
Name the VI Temp Monitor with LED
...
8-13 Use the DAQ Solution Wizard to open a VI that reads and displays the data logged in Exercise 8-4 and is called Simple Data Reader
...
© National Instruments Corporation 8-57 LabVIEW Basics I Course Manual Lesson 8 Data Acquisition and Waveforms Notes LabVIEW Basics I Course Manual 8-58 ni
...
Instrument drivers are discussed and used, along with the lower-level functions for performing instrument I/O
...
An overview of instrument control
...
About GPIB communication and configuration
...
About instrument drivers
...
How to use instrument driver VIs
...
An overview of the Virtual Instrument Software Architecture (VISA)
...
How to use the VISA functions
...
About serial port communication using LabVIEW
...
About waveform transfers
...
Instrument Control Overview You are not limited to the type of instrument that you control if you choose industry-standard control technologies
...
The things to be aware of with PC control of instrumentation are: • What type of connector (pinouts) are on the instrument
...
• What electrical properties are involved (signal levels, grounding, cable length restrictions)
...
• What kind of software drivers are available (see the next section)
...
This lesson discusses how you can use LabVIEW to control and acquire data from an external instrument
...
This lesson focuses on the two most common instrument communication methods—GPIB and serial port communication
...
com Lesson 9 Instrument Control B
...
The IEEE standardized the GPIB in 1975, and the GPIB became known as the IEEE 488 standard
...
The GPIB’s original purpose was to provide simultaneous computer control of test and measurement instruments; however, the GPIB is quite versatile and now is widely used for diverse applications including computer-to-computer communication and control of scanners and film recorders
...
It consists of eight data lines, five bus management lines (ATN, EOI, IFC, REN, and SRQ), three handshake lines, and eight ground lines
...
This means that whole bytes are sequentially handshaked across the bus at a speed that the slowest participant in the transfer determines
...
Every device, including the computer interface board, must have a unique GPIB address between 0 and 30
...
The instruments on the GPIB can use addresses 1 through 30
...
To transfer instrument commands and data on the bus, the Controller addresses one Talker and one or more Listeners
...
The LabVIEW GPIB VIs automatically handle the addressing and most other bus management functions
...
In the preferred method, the GPIB includes a hardware line (EOI) that can be asserted with the last data byte
...
Some instruments use this method instead of, or in addition to, the EOI line assertion
...
The byte count method is often used as a default termination method because the transfer stops on the logical OR of EOI, EOS (if used) in conjunction with the byte count
...
© National Instruments Corporation 9-3 LabVIEW Basics I Course Manual Lesson 9 Instrument Control GPIB Instruments COMPUTER GPIB Interface 43687
...
2356 GPIB Cable Additional electrical specifications allow data to be transferred across the GPIB at the maximum rate of 1 Mbyte/s because the GPIB is a transmission line system
...
• A maximum cable length of 20 m
...
If you exceed any of these limits, you can use additional hardware to extend the bus cable lengths or expand the number of devices allowed
...
com/support/gpibsupp
...
Software Architecture The software architecture for GPIB instrument control using LabVIEW is similar to the architecture for DAQ
...
These drivers are also available on your LabVIEW installation CD
...
The figure below shows the software architecture on the Windows platforms
...
com Lesson 9 Configuration and Diagnostic Tools Instrument Control LabVIEW LabVIEW Instrument I/O VIs and Functions Measurement & Automation Driver Software (*
...
MAX interacts with the various diagnostic and configuration tools installed with the driver and also with the Windows Registry and Device Manager
...
The LabVIEW Instrument I/O VIs and functions directly call the driver software
...
If you are using a different operating system, refer to the manuals that came with your GPIB interface board for the appropriate information for configuring and testing that board
...
It can also execute system diagnostics, add new channels, interfaces, and virtual channels, and view devices and instruments connected to your system
...
The four possible selections in MAX are: • Data Neighborhood—Use this selection to create virtual channels, aliases, and tags to your channels or measurements configured in Devices and Interfaces as you did in the DAQ lesson of this course
...
Using this © National Instruments Corporation 9-5 LabVIEW Basics I Course Manual Lesson 9 Instrument Control selection, you can view attributes of one or multiple devices, such as serial numbers
...
• Software—Use this section to determine which drivers and application software are installed and their version numbers
...
The graphic above shows the GPIB interface board in the MAX utility and the results of pressing the Scan for Instruments button at the top of the window
...
LabVIEW Basics I Course Manual 9-6 ni
...
1
...
Power on the NI Instrument Simulator and verify that both the Power and Ready LEDs are lit
...
Start the Measurement & Automation Explorer by either double-clicking on its icon on the desktop or by selecting it from the Tools menu in LabVIEW
...
Double-click on the section called Devices and Interfaces to see what boards are installed
...
2 software was correctly loaded on your machine
...
Select the GPIB board by clicking on it
...
Examine but do not change these settings
...
Close the GPIB Properties page by selecting the OK button
...
Return to the MAX window and verify that the GPIB board is still selected in the Devices and Interfaces section
...
8
...
You should see one instrument labeled Instrument0
...
Click on Instrument0 and you will see information about it in the MAX window to the right of the Configuration section
...
LabVIEW Basics I Course Manual 9-8 ni
...
Notice that the NI Instrument Simulator has a GPIB Primary Address (PAD) of 2
...
Click on the Communicate with Instrument button under the menu
...
12
...
The instrument should return its make and model number
...
13
...
The NI Instrument Simulator returns a simulated voltage measurement
...
Press the Query button again and a different value is returned
...
Press the Exit button to quit the interactive communication window when you are finished
...
You will set a VISA alias for the NI Instrument Simulator
...
While Instrument0 is selected in the MAX window, press the VISA Properties button
...
Note Be sure to remember the alias you assign to the NI Instrument Simulator
...
17
...
Because you can see the GPIB board, see the instrument, and communicate with the instrument, you can be assured that the GPIB interface and software driver are properly installed and configured
...
End of Exercise 9-1 LabVIEW Basics I Course Manual 9-10 ni
...
Instrument Driver Overview Now that you understand how to configure and test the presence of the GPIB board and any connected instruments, you will use LabVIEW to communicate with GPIB instruments
...
Therefore, you can write LabVIEW programs that use these functions directly
...
Learning and using the commands/protocol can be difficult
...
The instrument driver also calls the appropriate LabVIEW functions for the instrument
...
Instrument drivers are covered in more detail now
...
An instrument driver is a collection of functions that implement the commands necessary to perform the instrument’s operations
...
Instrument drivers are not necessary to use your instrument
...
Instrument drivers create the instrument commands and communicate with the instrument over the serial, GPIB, or VXI bus
...
With all of this work already done for you in the driver, instrument drivers can significantly reduce development time
...
You are protected against hardware changes and upgrades because it is much easier to upgrade your test code when all of the code specific to that particular instrument is self-contained within the instrument driver
...
com or you can contact National Instruments and request a copy of the LabVIEW Instrument Driver CD
...
Place this directory into the LabVIEW\instr
...
The next time you launch LabVIEW, you can access the instrument driver VIs from the Instrument Drivers subpalette of the Functions»Instrument I/O palette, as shown below
...
You must make sure to specify the correct GPIB address for the instrument as determined by the MAX utility
...
LabVIEW Basics I Course Manual 9-12 ni
...
vi To examine the installed LabVIEW instrument drivers and open and use the example VI from the NI DevSim instrument driver
...
Instrument drivers are available free of charge
...
LabVIEW automatically takes you to the Instrument Driver Network on ni
...
1
...
2
...
Select the NI Device Simulator subpalette and observe the categories of instrument driver VIs
...
Select the NI DEVSIM Getting Started VI from the Application Examples subpalette and place it in the open diagram
...
Double-click on the NI DEVSIM Getting Started VI to open and examine its front panel
...
Run the VI
...
(The simulator may take several seconds to acquire the waveform
...
Block Diagram 7
...
The device is first initialized with the Initialize VI, then commands are sent to configure and request information from the instrument in the Application Example VI, and finally the communication is ended with the Close VI
...
8
...
Do not save any changes
...
com Lesson 9 Instrument Control D
...
You can use these instrument drivers to build complete systems quickly and can reuse the drivers in a variety of systems and configurations
...
When you examined the block diagram for that VI, you noticed that the programming was broken down into general functions for the simulator
...
These instrument drivers are called LabVIEW instrument drivers because the source code is graphical programming made from standard LabVIEW functions and VIs
...
Components of an Instrument Driver All instrument drivers in the library have the same VI Tree structure
...
In fact, this hierarchy, sequence of VIs, and error checking are the same as those used in many other areas of I/O in LabVIEW—file I/O, data acquisition (DAQ), TCP/IP communications, etc
...
The high-level functions are built from the lower-level functions
...
However, the high-level functions such as the Getting Started VI you used in the last lesson are easy to use and have soft front panels that resemble the instrument
...
The initialize VI can optionally perform an identification query and reset operation
...
• Configuration Functions—A collection of VIs to configure the instrument to do desired operations
...
• Action/Status Functions—This category contains two types of functions
...
Status VIs obtain the current status of the instrument or the status of pending operations
...
An example of a status function is Query Transfer Pending
...
• Utility Functions—These VIs perform a wide variety of useful functions such as reset, self-test, error query, and revision query
...
All National Instruments instrument drivers are required to implement the following functions: initialize, close, reset, self-test, revision query, error query, and error message
...
Typically, this means configuring, triggering, and returning measurements from an instrument
...
The application VI is not intended to be a soft front panel for the instrument, but rather demonstrates of some instrument driver capabilities
...
LabVIEW Basics I Course Manual 9-16 ni
...
Just as all instrument drivers share a common set of functions, they also share common inputs and outputs
...
Before you can communicate with an instrument, you need to open a communication link to the instrument with the Initialize instrument driver VI
...
See the connector pane for the NI DEVSIM Initialize VI below
...
(For example, GPIB::2::INSTR is the instrument descriptor for a GPIB instrument at address 2
...
This control works similarly to the DAQ Channel Name control, but it is specifically used for instrument control
...
VISA will be covered in more detail in the next section
...
In addition, you gave the NI Instrument Simulator a VISA Alias of devsim in that first exercise
...
You specify the VISA Alias for the Resource Name/Instrument Descriptor in the instrument driver VIs
...
VISA Sessions When a connection to an instrument is made with the Initialize VI, a VISA session number is returned
...
You do not need to display this value; however, each time you communicate with that device again, you need to wire the VISA session input on the instrument driver VIs
...
LabVIEW Basics I Course Manual 9-18 ni
...
Each instrument driver VI contains Error In and Error Out terminals for passing error clusters from one VI to another
...
The error information is passed to the next VI (Error Out terminal)
...
Now that you have learned all the instrument driver-specific inputs and outputs, you are ready to use those VIs to communicate with an instrument
...
You will see this same sequence of events in every application that uses an instrument driver
...
Remember that you can right-click on the instrument driver VI terminals and choose Create»Constant, Create»Control, or Create»Indicator as needed
...
© National Instruments Corporation 9-19 LabVIEW Basics I Course Manual Lesson 9 Instrument Control Exercise 9-3 Objective: Voltage Monitor
...
You will build a VI that acquires a DC voltage measurement from the NI Instrument Simulator once every second and plots it in a waveform chart until the user presses a stop button
...
The minimum and maximum voltage values are calculated and displayed continuously on the panel
...
Open a new VI and build the panel shown above
...
com Lesson 9 Instrument Control Block Diagram 1
...
Structures the VI to continue to take DC voltage measurements until the user presses the Stop button
...
Create two shift registers by right-clicking on the right or left edge of the loop and selecting Add Shift Register from the shortcut menu
...
Opens the communication between LabVIEW and the NI Instrument Simulator
...
Change it to a False value with the Operating tool
...
NI DEVSIM Multimeter Configuration VI (Instrument I/O» Instrument Drivers»NI Device Simulator subpalette)
...
The default is 0
...
0 V DC
...
Returns a simulated voltage measurement from the NI Instrument Simulator
...
Ends the communication between LabVIEW and the NI Instrument Simulator
...
This function causes the While Loop to execute every second
...
Max & Min function (Comparison subpalette)
...
Simple Error Handler VI (Time & Dialog subpalette)
...
Unbundle by Name function (Cluster subpalette)
...
Or function (Boolean subpalette)
...
If there is an error or the Stop button is pushed, the While Loop stops
...
Wire only the necessary inputs for each VI—Instrument Descriptor, VISA Sessions, and Error I/O
...
Save this VI as Voltage Monitor
...
3
...
4
...
Notice that it communicates with the GPIB instrument (the LEDs alternate between Listen and Talk) each second to get a simulated voltage reading
...
5
...
End of Exercise 9-3 LabVIEW Basics I Course Manual 9-22 ni
...
VISA Overview Virtual Instrument Software Architecture (VISA) is the underlying layer of function calls used in the LabVIEW instrument driver VIs to communicate with the driver software
...
VISA History and Definitions For many years, industry has moved toward purchasing instrumentation from a variety of vendors
...
This trend required the definition of hardware standards to ensure the compatibility between different modules
...
But even with these improved hardware standards, a system was time consuming and expensive to put together
...
National Instruments initially addressed the software problems with instrument drivers, which helped reduce both integration time and software development costs
...
The goals of the alliance are to ensure multivendor interoperability for VXI systems and to reduce the development time for an operational system
...
The term VXIplug&play has come to indicate the conformity of hardware and software to these standards
...
• Maintain long-term compatibility with the installed base
...
• Maximize multiplatform capability
...
• Maximize software reuse
...
• Treat instrument drivers as part of the instrument
...
• Maximize cooperative support of end users
...
VISA by itself does not provide instrumentation programming capability
...
VISA can control VXI, GPIB, serial, or computer-based instruments and makes the appropriate driver calls depending on the type of instrument used
...
An apparent VISA problem could really be the result of an installation problem with one of the drivers VISA calls
...
2 PXI NI-VXI Specifically for LabVIEW, VISA is a single library of functions you use to communicate with GPIB, serial, VXI, and computer-based instruments
...
For example, some instruments ship with a choice for the type of interface
...
VISA solves this problem by providing a single set of functions that work for any type of interface
...
VISA Programming Terminology Before being introduced to VISA programming, you should become familiar with some of the VISA terminology
...
The functions you can use with an object are known as operations
...
You have already used this VISA terminology when you used the instrument driver VIs; the following terms give a review and little more information: • LabVIEW Basics I Course Manual Resource—This is any instrument in your system (includes serial and parallel ports)
...
com Lesson 9 Instrument Control • Session—You must open a VISA session to a resource to communicate with it, similar to a communication channel
...
You must use the Session Number in all subsequent VISA functions
...
• Instrument Descriptor—This is the exact name of a resource
...
You can think of the instrument descriptor as a telephone number and the resource as the person with whom you want to speak
...
Each call uses its own line, and crossing these lines would result in an error
...
Interface Grammar SERIAL ASRL[board][::INSTR] GPIB GPIB[board]::primary address[::secondary address][::INSTR] VXI VXI[board]::VXI logical address[::INSTR] GPIB-VXI GPIB-VXI[board][::GPIB-VXI primary address]::VXI logical address [::INSTR] The GPIB keyword establishes communication with a GPIB device
...
The GPIB-VXI keyword is for a GPIB-VXI controller
...
The INSTR keyword specifies a VISA resource of the type INSTR and it is used for complete VISA capability
...
The VISA alias is a name assigned to the instrument descriptor that you can use to communicate with an instrument without having to type in the instrument descriptor
...
On Macintosh, you edit a file called visaconf
...
© National Instruments Corporation 9-25 LabVIEW Basics I Course Manual Lesson 9 Instrument Control F
...
The VISA functions you will use most often are the VISA Write and VISA Read
...
Therefore, the VISA Write function is usually followed by a VISA Read function
...
dup VISA resource name returns the same handle to that session
...
return count contains the number of bytes actually transferred across the GPIB
...
The VISA Read function reads data from the device specified by the VISA resource name
...
dup VISA resource name returns the same handle to that session
...
return count contains the number of bytes actually transferred across the GPIB
...
LabVIEW Basics I Course Manual 9-26 ni
...
Notice that the full instrument descriptor is entered into the VISA resource name constant
...
Now you will build a VI that uses the VISA functions to read a waveform from the NI Instrument Simulator
...
vi To build a VI that uses the VISA functions to communicate with a GPIB device
...
You will use the VISA functions for the GPIB communication
...
Open a new VI and build the panel shown above
...
The Waveform Type text ring (Ring & Enum subpalette) has the following settings: 0 = Sine 1 = Square 2 = Noisy Sine 3 = Random 4 = Chirp You enter these values into the text ring control one at a time with the Labeling tool
...
Right-click on the ring control, select Add Item After from the shortcut menu, and type the second entry into the ring control
...
com Lesson 9 Instrument Control Block Diagram 1
...
This constant is used to build the command string for the NI Instrument Simulator
...
String constant (String subpalette)
...
The first one goes inside the array constant; resize the array constant to show five elements and use the Labeling tool to enter the five string elements as shown above
...
Index Array function (Array subpalette)
...
Concatenate Strings function (String subpalette)
...
VISA Write function (Instrument I/O»VISA subpalette)
...
Note If you do not have a GPIB card or an NI Instrument Simulator, use (Demo) VISA Write VI (User Libraries»Basics I Course subpalette) to simulate writing a command to the instrument
...
This function reads the response back from the NI Instrument Simulator
...
© National Instruments Corporation 9-29 LabVIEW Basics I Course Manual Lesson 9 Instrument Control If you do not have a GPIB card or an NI Instrument Simulator, use (Demo) VISA Read VI (User Libraries»Basics I Course subpalette) to simulate reading a string from the instrument
...
This VI pops open a dialog box if an error occurs and displays the error information
...
This VI converts the comma delimited string returned from the NI Instrument Simulator into an array of numbers which can then be plotted in the waveform graph
...
Save this VI as Read VISA Waveform
...
3
...
You should receive a waveform from the NI Instrument Simulator that matches the waveform type requested
...
Check the spelling, punctuation, spaces, and capitalization carefully
...
Reinitialize the instrument by turning the Power switch off and on again
...
Run the VI a few times requesting different waveforms each time to see how the waveform is read from the NI Instrument Simulator
...
5
...
End of Exercise 9-4 LabVIEW Basics I Course Manual 9-30 ni
...
Serial Port Communication Introduction and Definitions Serial communication is a popular means of transmitting data between a computer and a peripheral device such as a programmable instrument or even another computer
...
You can use this method when data transfer rates are low or you must transfer data over long distances
...
RS-232 Instrument Serial Port 76
...
Each transmitted character is packaged in a character frame that consists of a single start bit followed by the data bits, the optional parity bit, and the stop bit or bits
...
Baud rate is a measure of how fast data is moving between instruments that use serial communication
...
In such a two-state coding scheme, the baud rate is identical to the maximum number of bits of information, including “control” bits, that are transmitted per second
...
The truth table for RS-232 is: Signal > +3 V = 0 Signal < –3 V = 1 The output signal level usually swings between +12 V and –12 V
...
A start bit signals the beginning of each character frame
...
If the instrument is transmitting at 9600 baud, the duration of the start bit and each subsequent bit will be about 0
...
The entire character frame of eleven bits would be transmitted in about 1
...
Data bits are transmitted “upside down and backwards
...
To interpret the data bits in a character frame, you must read from right to left, and read 1 for negative voltage and 0 for positive voltage
...
An ASCII conversion table shows that this is the letter “m”
...
The parity bit, if present, also follows inverted logic (1 for negative voltage and 0 for positive voltage
...
You specify ahead of time whether the parity of the transmission is to be even or odd
...
The transmission in the figure above uses odd parity
...
The last part of a character frame consists of 1, 1
...
These bits are always represented by a negative voltage
...
The transmission of the next character frame, if any, is heralded by a start bit of positive (SPACE) voltage
...
com Lesson 9 Instrument Control How Fast Can I Transmit? Knowing the structure of a character frame and the meaning of baud rate as it applies to serial communication, you can calculate the maximum transmission rate, in characters per second, for a given communication setting
...
In the case above, there are a total of eleven bits per character frame
...
Note that this is the maximum character transmission rate
...
Hardware Overview There are many different kinds (recommended standards) of serial port communication
...
RS-232 The RS-232 is a standard developed by the Electronic Industries Association (EIA) and other interested parties, specifying the serial interface between Data Terminal Equipment (DTE) and Data Communications Equipment (DCE)
...
The most frequently encountered revision of this standard is called RS-232C
...
The serial ports on standard IBM compatible personal computers follow RS-232
...
RS-449 was issued in 1975 and was supposed to supersede RS-232, but few manufacturers have embraced the new standard
...
While RS-232 modulates a signal with respect to a common ground (called single-ended transmission), RS-422 modulates two signals against each other (called differential transmission)
...
This makes RS-422 more immune to noise and interference and more versatile over longer distances
...
RS-423 can then communicate with most RS-232 devices over distances of 15 m or so
...
These are DCE (Data Communications Equipment) and DTE (Data Terminal Equipment
...
, while DTE is your computer or terminal
...
Both of these connectors are male on the back of the PC; thus, you will require a female connector on your device
...
Table 9-1
...
It is compact, yet has enough pins for the “core” set of serial pins (with one pin extra)
...
Be careful of this difference when you are determining if a device is DTE or DCE
...
com Lesson 9 Instrument Control Table 9-2
...
The table shows only the “core” set of pins that are used for most RS-232 interfaces
...
The VISA Write and VISA Read functions will work with any type of instrument communication and are the same whether you are doing GPIB or serial communication
...
The VISA Configure Serial Port VI initializes the port identified by VISA resource name to the specified settings
...
baud rate, data bits, parity, and flow control specify those specific serial port parameters
...
The example above shows how to send the identification query command *IDN? to the instrument connected to the COM2 serial port
...
Then the VISA Write function sends the command
...
The VIs and functions contained in the Instrument I/O»Serial subpalette are also used for parallel port communication
...
For example, you can use the MAX utility to determine that LPT1 has a VISA resource name of ASRL10::INSTR
...
com Lesson 9 Exercise 9-5 Objective: Instrument Control Serial Write & Read
...
You will build a VI that communicates with the NI Instrument Simulator
...
The NI Instrument Simulator 1
...
Software handshaking involves embedding control characters in transmitted data
...
Hardware handshaking uses voltages on physical wires to control data flow
...
Most lab equipment uses hardware handshaking
...
Make sure the NI Instrument Simulator is connected to a serial port on your computer with a serial cable
...
© National Instruments Corporation 9-37 LabVIEW Basics I Course Manual Lesson 9 Instrument Control 3
...
This is an indication that the device is in serial communication mode
...
Open a new VI and build the panel shown above
...
Open and build the diagram shown above using the following components: VISA Configure Serial Port VI (Instrument I/O»Serial subpalette)
...
Right-click on each of the input terminals and select Create»Constant to provide the serial port parameters shown above
...
com Lesson 9 Instrument Control Line Feed constant (String subpalette)
...
Concatenate Strings function (String subpalette)
...
VISA Write function (Instrument I/O»Serial subpalette)
...
Note If you do not have a serial port or an NI Instrument Simulator, use (Demo) VISA Write VI (User Libraries»Basics I Course subpalette) to simulate writing a command to the instrument
...
This function reads the response back from the NI Instrument Simulator
...
You will use two of these functions—one for the seven-byte header and the second for the data string
...
Scan From String function (String subpalette)
...
This function converts the first seven characters into a number that is then used for the byte count of the second VISA Read function
...
This VI pops open a dialog box if an error occurs and displays the error information
...
Save this VI as Read VISA Waveform
...
3
...
Type *IDN? into the String to Write control
...
Run the VI
...
© National Instruments Corporation 9-39 LabVIEW Basics I Course Manual Lesson 9 Instrument Control 5
...
Below are some commands to try
...
6
...
End of Exercise 9-5 LabVIEW Basics I Course Manual 9-40 ni
...
Waveform Transfers (Optional) Many instruments return a waveform as either an ASCII string or a binary string
...
Binary encoding requires fewer bytes than ASCII encoding
...
Using ASCII encoding, you would need a maximum of 4 bytes to represent each point (a maximum of 3 bytes for the value of the point and 1 byte for the separator, such as a comma)
...
Below is an example of an ASCII waveform string
...
1024 points in total
...
Extract Numbers
...
Using binary encoding, you need only 1 byte to represent the point, assuming each point is an unsigned 8-bit integer
...
1024 bytes in total
...
You must convert the string to an integer array
...
You must remove all header and trailer information from the string before you can convert it to an array
...
Binary Waveform String String (without header or trailer) Waveform Numeric Array Binary Waveforms Encoded as 2-Byte Integers If each point in the binary waveform string is encoded as a 2-byte integer, it is easier and much faster to use the Type Cast function (Advanced»Data Manipulation subpalette)
...
) For example, consider a GPIB oscilloscope that transfers waveform data in binary notation
...
Each data point is a 2-byte signed integer
...
Assume the waveform has a 4-byte header “DATA” and a 2-byte trailer—a carriage return character followed by a line feed character
...
«HB1024»«LB1024»«CR»«LF» 2 bytes representing the first data point Memory «LF»«CR»«LB1024»«HB1024»
...
com Lesson 9 Instrument Control The following block diagram shows how you can use the Type Cast function to cast the binary waveform string into an array of 16-bit integers
...
Remember, the GPIB is an 8-bit bus
...
If the instrument first sends the low byte and then the high byte, you do not need to use the Swap Bytes function
...
Because the high-order byte is received first, it is placed in a lower memory location than the low-order byte sent after the high-order byte
...
© National Instruments Corporation 9-43 LabVIEW Basics I Course Manual Lesson 9 Instrument Control Exercise 9-6 Objective: Waveform Example
...
For the ASCII waveform string, assume the waveform consists of 128 points
...
A header precedes the data points, as shown below: CURVE {12,28,63,
...
,}CR LF For the binary waveform string, assume that the waveform consists of 128 points
...
A header precedes the data points, as shown below: CURVE % {Bin Count MSB}{Bin Count LSB}{åå¤Å
...
} {Checksum} CR LF You will examine a VI that converts the waveform to an array of numbers
...
In this exercise, the VI reads the waveform string from the NI Instrument Simulator or from a previously stored array
...
Turn off the NI Instrument Simulator and configure it to communicate through the GPIB by setting the switches on the side of the box as shown below: This configures the instrument as a GPIB device with an address of 2
...
Turn on the NI Instrument Simulator
...
This means the NI Instrument Simulator is in GPIB communication mode
...
com Lesson 9 Instrument Control Front Panel 1
...
2
...
The string indicator displays the waveform string
...
Data Format specifies either an ASCII waveform or a binary waveform
...
© National Instruments Corporation 9-45 LabVIEW Basics I Course Manual Lesson 9 Instrument Control Block Diagram 1
...
String Length function (String subpalette)
...
String Subset function (String subpalette)
...
This excludes the header and trailer bytes from the binary waveform string
...
In this exercise, this function converts the binary string into an array of unsigned integers
...
In this exercise, this VI extracts numbers from the ASCII waveform string and puts them in an array
...
The VISA Write and VISA Read VIs query the NI Instrument Simulator for a square wave in either ASCII or one-byte binary format
...
LabVIEW Basics I Course Manual 9-46 ni
...
Return the front panel and run the VI
...
With the Data Format switch set to ASCII, the ASCII waveform string is displayed, the values are converted to a numeric array, and the string length and numeric array are then displayed
...
Select the Binary option from the Data Format control
...
The binary waveform string and string length are displayed, and the string is converted to a numeric array and displayed in the graph
...
Notice that the binary waveform is similar to the ASCII waveform; however, the number of bytes in the string is significantly lower
...
6
...
Do not save any changes
...
For this exercise, assume that you are acquiring a waveform from a GPIB digitizing oscilloscope
...
The waveform is composed of 128 data points
...
Therefore, the entire waveform is composed of 256 bytes
...
For example, 5-byte header 1-byte terminating character (line feed) #3256
...
You can configure the NI Instrument Simulator to output waveform data encoded as 2-byte integers by first sending it the command “FORM:DATA INT, 16:” and then querying the Simulator for the waveform by sending it the command “SENS:DATA?”
...
Each data point is a 2-byte signed integer
...
The waveform contains a 5-byte header and a 1-byte trailer, as shown in the example above
...
vi
...
com Lesson 9 Instrument Control Summary, Tips, and Tricks • LabVIEW can communicate with an instrument that connects to your computer as long as you know what kind of interface it is and what cabling is required
...
• The LabVIEW Instrument Driver library eliminates the need to have an intimate knowledge of a specific instrument or I/O interface
...
• There are more than 600 instrument drivers in the library
...
) If you have an instrument that is not on the list, you can find a similar instrument on the list and easily modify its driver
...
• Instrument Driver VIs share a common hierarchy and contain a getting started example for you to test the instrument communication
...
• Serial communication is a popular means of transmitting data between a computer and a peripheral device such as a programmable instrument or even another computer
...
• Instruments can transfer data in many different formats
...
LabVIEW contains many VIs and functions to convert waveform data to a usable form
...
9-9 Open the Voltage Monitor VI you built in Exercise 9-3
...
txt in the following format: Save the VI as Voltage Data to File
...
LabVIEW Basics I Course Manual 9-50 ni
...
com Lesson 10 VI Customization Introduction This lesson introduces several VI Properties and features for customizing your VIs
...
You Will Learn: A
...
B
...
C
...
D
...
E
...
© National Instruments Corporation 10-1 LabVIEW Basics I Course Manual Lesson 10 VI Customization A
...
For example, you can remove the LabVIEW menus and toolbar so that the user does not need to worry about options that are unfamiliar or unnecessary for the operation of the application
...
Access these options by right-clicking the icon pane in the upper-right corner of the front panel or block diagram and selecting VI Properties, or by selecting File»VI Properties
...
You can examine each category of properties to see what you can customize about your VI
...
LabVIEW Basics I Course Manual 10-2 ni
...
By default, the front panel title is the same as the VI name
...
To customize the panel window appearance, you can either select one of the predefined styles for the panel window from the radio buttons or create a custom appearance
...
• Dialog—This style window is modal (stays on top of all other windows), has no menu, scroll bars, or toolbar, has a highlighted Boolean, allows the user to close the window but does not allow the user to resize the window, uses the runtime shortcut menus, and shows the front panel when called
...
All options such as scrollbars, menus, toolbars, etc
...
© National Instruments Corporation 10-3 LabVIEW Basics I Course Manual Lesson 10 VI Customization • Custom—This style allows you to select custom window appearance options based on what you select in the Customize window as shown in the following figure: The settings shown above are for the Default style window
...
To clear an option, click on the checkmark next to the option, and the checkmark disappears
...
For example, you can hide the Abort and Continuous Run buttons so that the user cannot select either one
...
com Lesson 10 VI Customization Window Size You also can control the sizing of the front panel and front panel objects
...
For example, if you allow the user to resize the window in the Window Appearance category, the user cannot resize the front panel smaller than the width and height defined here
...
• Maintain Proportions of Window for Different Monitor Resolutions—Use this setting when the development machine has a different resolution than the run-time machine
...
• Scale All Objects on Panel as the Window Resizes—Use this setting when the end user is allowed to resize the front panel while a VI is running
...
Text is the only thing that does not resize; the font sizes are fixed
...
Creating Pop-Up Panels Pop-up panels are a useful technique for creating LabVIEW applications with a nice user interface
...
A better way to display data is to have a series of front panels belonging to various subVIs that open and display information when a user requests it
...
The first method is to use the VI Properties»Window Appearance options
...
However, these options also contain other settings you might not want
...
You can use the Custom option to make pop-up panels by making the following selections from the Customize window settings: When you make changes to a VI in the VI Properties settings, these options affect the VI every time it is used
...
LabVIEW Basics I Course Manual 10-6 ni
...
Right-click the subVI and select SubVI Node Setup to get the following dialog box: The options in this dialog box include: • Open Front Panel when loaded—If selected, the VI front panel pops open when the VI is loaded into memory as a subVI, or, when the main VI that calls it is loaded into memory
...
• Close afterwards if originally closed—If “Show Front Panel when called” is also selected, the VI front panel pops open when the VI is executed as a subVI, and the front panel is closed again after the subVI execution completes
...
• Suspend when called—If selected, the calling VI execution is suspended when the subVI is called
...
Now create a VI that uses a pop-up subVI
...
Build a VI that acquires temperature once every 0
...
After the acquisition is complete, the VI pops open a subVI panel that shows the acquired data in a graph
...
Front Panel 1
...
The thermometer displays the current temperature and the number of data values shown
...
Build the block diagram shown above
...
com Lesson 10 VI Customization For Loop, available on the Functions»Structures palette—Structures the VI to repeat 20 measurements
...
Thermometer VI, available in the Select a VI»LV Basics I directory—Acquires the current temperature value
...
Create the constant by right-clicking the input terminal and selecting Create»Constant
...
5 to scale the x values to represent the time interval at which the VI takes the measurements
...
Pop-Up Graph VI, available in the Select a VI»LV Basics I directory—Plots the temperature data into an XY Graph
...
2
...
Name it Use Pop-Up Graph
...
3
...
Double-click the Pop-Up Graph subVI to open its front panel
...
Configure the VI so that it automatically displays its front panel
...
2
...
© National Instruments Corporation 10-9 LabVIEW Basics I Course Manual Lesson 10 VI Customization 3
...
Configure the window appearance as shown below: 4
...
5
...
If it is not closed, it will not close after the subVI finishes running
...
Run the main VI, Use Pop-Up Graph
...
Click the DONE button to return to the calling VI
...
Change the window appearance settings for the Pop-Up Graph subVI again
...
Close and save as Pop-Up Graph
...
8
...
9
...
End of Exercise 10-1 LabVIEW Basics I Course Manual 10-10 ni
...
Key Navigation While a VI is running, you can press to change the key focus from one control to the next
...
While a control has the key focus, you can use the keyboard to assign the control’s value
...
Whatever keystrokes you type are directly entered into the control
...
All front panel controls also have a Key Navigation option
...
When you perform the keystroke while the VI is running, LabVIEW acts as if you clicked the appropriate control
...
To associate a front panel control with a keystroke, select the Key Navigation option from the control’s Advanced shortcut menu as shown: © National Instruments Corporation 10-11 LabVIEW Basics I Course Manual Lesson 10 VI Customization The Key Navigation dialog box appears as shown in the following figure
...
The Key Navigation dialog box also allows you to define the action of the key while the VI is running
...
The front panel control names that appear in the Current Assignments list correspond to the owned labels of those controls
...
LabVIEW Basics I Course Manual 10-12 ni
...
Build a temperature monitoring system you can use to view three different subtests on request
...
To ensure that the program executes correctly, hide the Stop button on the toolbar and run the VI when it opens
...
Open the Temperature System VI from the Exercises\LV Basics I directory
...
The mechanical action of each button is set to “Latch
...
© National Instruments Corporation 10-13 LabVIEW Basics I Course Manual Lesson 10 VI Customization Block Diagram 1
...
Be sure to leave all the FALSE cases empty
...
Open the subVI front panel by double-clicking its icon and examine the block diagram
...
Display and Log Temp VI, available on the Functions»User Libraries»Basics I Course palette—In this exercise, this VI simulates a temperature measurement every half-second (500 ms), plots it on a strip chart, and logs it to a file
...
Close the front panel before you proceed
...
The VI then opens the file, reads the logged data, and displays it on a graph
...
Close the front panel before you proceed
...
5 seconds)
...
com Lesson 10 VI Customization 2
...
Set the following options in the SubVI Node Setup dialog box
...
Repeat Step 2 for the Display and Log Temp subVI and Display Logged Temp subVI
...
Save the VI
...
Return to the front panel and run the VI
...
Try the key assignments to display the temperature, display and log the temperature, and so on
...
Try pressing to return to the main front panel
...
Stop the VI
...
When you are sure everything is in proper working order, configure the Temperature System VI so that it automatically runs when you open the VI
...
Configure the Execution properties so that the Run When Opened box is checked as shown below
...
Configure the VI so that none of the buttons is visible in the toolbar during the VI execution
...
Disable the menubar as shown below
...
Save all subVIs and save and close the Temperature System VI
...
Open the Temperature System VI again
...
11
...
When you have finished, close the VI
...
com Lesson 10 VI Customization D
...
For example, suppose you selected the Run When Opened option and then disabled all menus and toolbar options
...
You cannot stop the VI without it closing and exiting LabVIEW
...
The function for exiting LabVIEW is called Quit LabVIEW and is available on the Functions»Application Control palette
...
Quit LabVIEW has one input, and if that input is wired, the end of your LabVIEW session occurs only if that input is TRUE
...
The first step in preventing you from making it difficult to edit your own VIs is for you to save the VI to a new location before you modify the VI Properties
...
The Save with options dialog box appears
...
You also can select that the LabVIEW vi
...
Once you have saved your VI to a new location, you can modify the other copy of your VI by changing the VI Properties
...
If you select the Remove diagrams option, you remove the source code to your VI
...
Select this option only if you are certain you will never need to edit the VI again, and make sure that you have saved a backup copy of the VI, with the diagrams, to a safe place
...
The next exercise addresses such a situation
...
com Lesson 10 VI Customization Exercise 10-3 Edit Me VI (Optional) Objective: To edit a VI that has several of its VI Properties changed
...
Front Panel 1
...
2
...
Notice that the toolbar and menu bar are disabled along with the shortcut keystrokes that accompany the menu options, such as the command to abort the VI
...
3
...
After 10 seconds, the VI ends and then quits LabVIEW
...
Relaunch LabVIEW and open a New VI
...
a
...
The VI Properties will most likely not be set on the subVI
...
Such a modification could involve placing an Add function on the diagram
...
Now you can open the VI you want to edit
...
It will then open in Edit mode and have a broken Run arrow
...
b
...
© National Instruments Corporation 10-19 LabVIEW Basics I Course Manual Lesson 10 VI Customization 5
...
6
...
The front panel for the Edit Me VI opens
...
Notice that although you can get to the block diagram of the Edit Me VI, you cannot edit it
...
Go to the Operate menu and select Change to Edit Mode
...
9
...
You now can edit the VI
...
10
...
11
...
Close the new VI and do not save changes
...
Open the Edit Me VI again and test that it has the correct options that allow you to edit it when it is finished running
...
Close the Edit Me VI
...
com Lesson 10 VI Customization E
...
You can create your own set of palettes by adding new subpalettes, hiding options, or moving items from one menu to another
...
lib and instr
...
To add your VIs to the default Functions palette, simply save your directories, VIs, or libraries inside the user
...
When you restart LabVIEW, the User Libraries subpalette of the Functions palette will contain subpalettes for each directory,
...
mnu file in user
...
lib
...
lib
...
The lvbasics
...
lib illustrates this feature
...
LabVIEW ships with four predefined views: the basic, the default, the DAQ, and the T & M (Test & Measurement) view
...
© National Instruments Corporation 10-21 LabVIEW Basics I Course Manual Lesson 10 VI Customization You can select any predefined palette set shown below: In addition to having different palette sets to choose from, you also can select icon-based palettes or text-based palettes
...
Access the Palettes Editor by pressing the Edit Palettes button
...
LabVIEW Basics I Course Manual 10-22 ni
...
You also can rearrange the contents of palettes by dragging objects to new locations
...
You can add a palette, move it to a new location, edit the subpalette icon, or rename the palette using the Palettes Editor
...
A palette also can contain VIs from different locations
...
mnu files
...
For more information on how views and menus work, refer to Help»Contents and Index under Customizing the Controls and Functions Palettes
...
To edit the top-level Controls or Functions palettes or any other predefined menus, or views, you first must create a new view by selecting new setup from the Palette Set ring in the Edit Palettes dialog box
...
© National Instruments Corporation 10-23 LabVIEW Basics I Course Manual Lesson 10 VI Customization To create a palette from scratch or hook in a palette that is not in user
...
lib, or instr
...
When you select this option, the Insert Submenu dialog box appears
...
mnu)—Use this option to insert a new, empty palette
...
Add a
...
Link to an existing menu file (
...
Selecting this option also recursively creates subpalettes for each subdirectory, VI library, or
...
Palettes created by this method automatically update as you add or remove files from the directories
...
llb)—Use this option to link entries from VI libraries to the Controls and Functions palettes
...
LabVIEW Basics I Course Manual 10-24 ni
...
Create a new view and customize the Functions palette to include the VIs from the Exercises\LV Basics I directory
...
Open a new front panel by selecting File»New
...
) 2
...
3
...
4
...
5
...
6
...
7
...
A file dialog box displays the contents of the LabVIEW Course view directory
...
Select a directory to associate with the submenu (subpalette)
...
A subpalette is created with the contents of LV Basics I directory
...
9
...
Observe the icons of the VIs in the LV Basics I directory visible in the Basclass VIs subpalette
...
Delete blank icons and rearrange icons by right-clicking the icons and selecting the respective operation
...
Close the LV Basics I subpalette
...
Select Save Changes from the Edit Palettes dialog box
...
Switch to the block diagram and display the Functions palette by selecting Window»Show Functions Palette if it is not already showing
...
14
...
15
...
End of Exercise 10-4 LabVIEW Basics I Course Manual 10-26 ni
...
These modifications include hiding toolbar buttons, running the VI when loaded, opening front panels when called, and so on
...
Other calls to the same VI are not affected
...
• To create a pop-up panel, select the Show Front Panel when Called and Close Afterwards if Originally Closed options from the VI Properties»Window Appearance»Customize options or the Sub VI Node Setup option of a subVI’s shortcut menu
...
You can access the Key Navigation menu through a control’s shortcut Advanced menu
...
• You can have a VI programmatically exit LabVIEW by using the Quit LabVIEW function
...
The VI automatically opens in edit mode, because it is nonexecutable with a broken subVI
...
You can edit the Controls and Functions palettes to display any options you want
...
com Appendix This appendix contains the following sections of useful information for LabVIEW users: A
...
ASCII Character Code Equivalents Table C
...
Instructor’s Notes © National Instruments Corporation A-1 LabVIEW Basics I Course Manual Appendix A
...
National Instruments Technical Support Options The best way to get technical support and other information about LabVIEW, test and measurement, instrumentation, and other National Instruments products and services is the NI Web site at ni
...
Another excellent place to obtain support while developing various applications with National Instruments products is the NI Developer Zone at ni
...
The Alliance Program The National Instruments Alliance Program joins system integrators, consultants, and hardware vendors to provide comprehensive service and expertise to customers
...
Information about and links to many of the Alliance Program members are available from the National Instruments Web site
...
You can read, search, and post to the newsgroups to share solutions and find additional support from other users
...
Other National Instruments Training Courses National Instruments offers several training courses for LabVIEW users
...
com/custed
...
You can purchase just the course materials or sign up for an instructor-led hands-on course by contacting National Instruments
...
com Appendix LabVIEW Publications LabVIEW Technical Resource (LTR) Newsletter Subscribe to LabVIEW Technical Resource to discover power tips and techniques for developing LabVIEW applications
...
In addition, every issue contains a disk of LabVIEW VIs and utilities that implement methods covered in that issue
...
ltrpub
...
The National Instruments Web site contains a list of all the LabVIEW books and links to places to purchase these books
...
The info-labview Listserve Info-labview is an e-mail group of users from around the world who discuss LabVIEW issues
...
Send subscription messages to the info-labview list processor at: listmanager@pica
...
mil Send other administrative messages to the info-labview list maintainer at: info-labview-REQUEST@pica
...
mil Post a message to subscribers at: info-labview@pica
...
mil You may also want to search the ftp archives at: ftp://ftp
...
army
...
© National Instruments Corporation A-3 LabVIEW Basics I Course Manual Appendix B
...
Hex Octal Decimal ASCII Hex Octal Decimal ASCII 00 000 0 NUL 20 040 32 SP 01 001 1 SOH 21 041 33 ! 02 002 2 STX 22 042 34 " 03 003 3 ETX 23 043 35 # 04 004 4 EOT 24 044 36 $ 05 005 5 ENQ 25 045 37 % 06 006 6 ACK 26 046 38 & 07 007 7 BEL 27 047 39 ' 08 010 8 BS 28 050 40 ( 09 011 9 HT 29 051 41 ) 0A 012 10 LF 2A 052 42 * 0B 013 11 VT 2B 053 43 + 0C 014 12 FF 2C 054 44 , 0D 015 13 CR 2D 055 45 - 0E 016 14 SO 2E 056 46
...
com Appendix Hex Octal Decimal ASCII Hex Octal Decimal ASCII 1A 032 26 SUB 3A 072 58 : 1B 033 27 ESC 3B 073 59 ; 1C 034 28 FS 3C 074 60 < 1D 035 29 GS 3D 075 61 = 1E 036 30 RS 3E 076 62 > 1F 037 31 US 3F 077 63 ? 40 100 64 @ 60 140 96 ` 41 101 65 A 61 141 97 a 42 102 66 B 62 142 98 b 43 103 67 C 63 143 99 c 44 104 68 D 64 144 100 d 45 105 69 E 65 145 101 e 46 106 70 F 66 146 102 f 47 107 71 G 67 147 103 g 48 110 72 H 68 150 104 h 49 111 73 I 69 151 105 i 4A 112 74 J 6A 152 106 j 4B 113 75 K 6B 153 107 k 4C 114 76 L 6C 154 108 l 4D 115 77 M 6D 155 109 m 4E 116 78 N 6E 156 110 n 4F 117 79 O 6F 157 111 o 50 120 80 P 70 160 112 p 51 121 81 Q 71 161 113 q 52 122 82 R 72 162 114 r 53 123 83 S 73 163 115 s 54 124 84 T 74 164 116 t 55 125 85 U 75 165 117 u 56 126 86 V 76 166 118 v © National Instruments Corporation A-5 LabVIEW Basics I Course Manual Appendix Hex Octal Decimal ASCII Hex Octal Decimal ASCII 57 127 87 W 77 167 119 w 58 130 88 X 78 170 120 x 59 131 89 Y 79 171 121 y 5A 132 90 Z 7A 172 122 z 5B 133 91 [ 7B 173 123 { 5C 134 92 \ 7C 174 124 | 5D 135 93 ] 7D 175 125 } 5E 136 94 ^ 7E 176 126 ~ 5F 137 95 _ 7F 177 127 DEL LabVIEW Basics I Course Manual A-6 ni
...
VI Quick Reference This section contains a list of the VIs and functions used in the course
...
Returns the maximum and minimum values and their indices in a 1D array
...
Returns the number of elements in an array
...
Returns a portion of an array
...
Concatenates two arrays or adds extra elements to an array
...
Returns an element of an array
...
Returns an array in which every element is initialized to a specific value
...
Returns the maximum and minimum values and their indices in a 1D array
...
Inverts the current Boolean value
...
Creates data necessary for graphs and multiplot strip charts
...
This function replaces elements in a cluster by their owned labels
...
This function disassembles cluster elements according to the size and order of the elements
...
This function disassembles cluster elements by their owned labels
...
Returns a True if the top input value is greater than the bottom input value
...
Returns a True if the input value is greater than or equal to zero
...
Outputs the minimum and the maximum values of two unknown inputs
...
Compares two values and outputs a Boolean value indicating True if the two values are not equal
...
Acts as a Boolean gate
...
Data Acquisition AI Acquire Waveform VI (Data Acquisition»Analog Input subpalette)
...
AI Acquire Waveforms VI (Data Acquisition»Analog Input subpalette)
...
AI Sample Channel VI (Data Acquisition»Analog Input subpalette)
...
AO Generate Waveform VI (Data Acquisition»Analog Output subpalette)
...
AO Update Channel VI (Data Acquisition»Analog Output subpalette)
...
(Demo) Read Voltage VI (User Libraries»Basics I Course subpalette)
...
LabVIEW Basics I Course Manual A-8 ni
...
Reads the analog input voltage at Channel 0
...
Outputs the specified digital pattern to the specified digital port
...
Sounds a beep
...
Displays a dialog box
...
Pops open a dialog box if an error occurs and reports all of the error information
...
Closes a file
...
Formats the input parameters into a string and writes that string to a file
...
Displays an interactive file dialog box that you use to create a new file or open an existing one
...
Reads bytes of data from the file starting at the current file mark (beginning of the file)
...
Reads data from a spreadsheet file into an array
...
Writes data to a file
...
Writes array data to a spreadsheet format file that you specify
...
Ends the communication between LabVIEW and the NI Instrument Simulator
...
Opens the communication between LabVIEW and the NI Instrument Simulator
...
Returns a simulated voltage measurement from the NI Instrument Simulator
...
Configures the range of voltage measurements that the NI Instrument Simulator generates
...
0 to 10
...
VISA Configure Serial Port VI (Instrument I/O»Serial subpalette)
...
VISA Read function (Instrument I/O»VISA subpalette)
...
VISA Write function (Instrument I/O»VISA subpalette)
...
Mathematics General Polynomial Fit VI (Mathematics»Curve Fitting subpalette)
...
Mean VI (Mathematics»Probability and Statistics subpalette)
...
Numeric Add function (Numeric subpalette)
...
Compound Arithmetic function (Numeric subpalette)
...
Divide function (Numeric subpalette)
...
This function works with values, arrays, or clusters
...
Adds one to the input value
...
com Appendix Multiply function (Numeric subpalette)
...
Random Number (0-1) function (Numeric subpalette)
...
Round To Nearest function (Numeric subpalette)
...
Sine function (Numeric»Trigonometric subpalette)
...
Sine & Cosine function (Numeric»Trigonometric subpalette)
...
Square Root function (Numeric subpalette)
...
Signal Processing Sine Pattern VI (Analyze»Signal Processing»Signal Generation subpalette)
...
Uniform White Noise VI (Analyze»Signal Processing»Signal Generation subpalette)
...
String Concatenate Strings function (String subpalette)
...
Extract Numbers VI (User Libraries»Basics Course subpalette)
...
Numbers in the string are assumed to be in ASCII and separated by a non-numeric character such as a comma
...
Converts a number to a string
...
Returns the matched string and portions of the string before and after the match
...
Converts a number (scalar, array, or cluster) to a string in fractional format
...
Converts a string to a number
...
Returns the number of characters in a string
...
Returns a portion of a string
...
Returns the current date and time in string format
...
Returns the current value of the operating system’s software timer in milliseconds since the computer was powered on
...
Controls loop timing
...
com Appendix D
...
Each station consists of the following: GPIB Board Board ID = 1 LabVIEW Basics I Course Manual DAQ MIO Board Q N AT SR Y ER D TE LK EA LIS TA W Other Items: a
...
GPIB cable to connect the instrument simulator to the GPIB Board c
...
Wires (two per station) e
...
Copy the files from the disks accompanying this manual as described in the Self-Paced Use section in the Student Guide and the ReadMe
...
3
...
4
...
5
...
© National Instruments Corporation A-13 LabVIEW Basics I Course Manual Appendix Notes LabVIEW Basics I Course Manual A-14 ni
...
This information helps us provide quality products to meet your needs
...
____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ ____________________________________________________________________________________________ If you find errors in the manual, please record the page numbers and describe the errors
...
Name _______________________________________________________________________________________ Title ________________________________________________________________________________________ Company ____________________________________________________________________________________ Address _____________________________________________________________________________________ ____________________________________________________________________________________________ E-mail Address _______________________________________________________________________________ Phone ( ___ )____________________________________ Fax ( ___ ) ___________________________________ Mail to: Customer Education National Instruments Corporation 11500 North Mopac Expressway Austin, Texas 78759-3504 Fax to: Customer Education National Instruments Corporation 512 683 6837 Course Evaluation Course _______________________________________________________________________________________ Location _____________________________________________________________________________________ Instructor _________________________________________ Date ____________________________________ Student Information (optional) Name ________________________________________________________________________________________ Phone ___________________________________ Company _________________________________________ Instructor Please evaluate the instructor by checking the appropriate circle
...
Did the course cover material as advertised? ❍ Too short ❍ Too much The detail of topics covered in the course was ❍ Yes ❍ Yes ❍ Just right ❍ No ❍ Not enough ❍ Sometimes ❍ No I had the skills or knowledge I needed to attend this course
...
____________________________________ _____________________________________________________________________________________________ _____________________________________________________________________________________________ Do you have other training needs that we could assist you with? _________________________________________ _____________________________________________________________________________________________ How did you hear about this course? ❍ National Instruments web site ❍ National Instruments Sales Representative ❍ Mailing ❍ Co-worker ❍ Other _____________________________________________________________ Customer Education Student Profile Name ____________________________________________ Title _____________________________________ Company _________________________________________ Mail Stop _________________________________ Mailing Address _______________________________________________________________________________ City __________________ State/Province ____________ Telephone ________________________________________ Country ______________ Zip ______________ Fax ______________________________________ E-Mail _______________________________________________________________________________________ Date _____________________________________________ Event Location _____________________________ Industry and Application Information Which industry does your company primarily serve? (check only one) ❏ Automotive ❏ Industrial systems factory floor/integrator ❏ Pharmaceutical ❏ Test, measurement, and instrumentation ❏ Computer ❏ Medical ❏ Aero/avionics ❏ Telecommunications ❏ Consumer products ❏ Military/space ❏ Semiconductor ❏ University/education ❏ Electronics ❏ Paper/pulp ❏ ATE/automated test ❏ Graphics ❏ Petrochemical/plastics ❏ Other ______________ If you are currently a customer of National Instruments, please check the products you use: ❏ LabVIEW™ ❏ HiQ™ ❏ DAQ ❏ Fieldbus™ ❏ LabWindows/CVI™ ❏ ComponentWorks™ ❏ SCXI™ ❏ IMAQ™ Vision ❏ BridgeVIEW™ ❏ VirtualBench™ ❏ GPIB ❏ Serial ❏ Lookout™ ❏ Measure™ ❏ VXI ❏ Motion control ❏ HP-UX Please check the operating system(s) you use: ❏ Windows 95 ❏ Windows 3
...
❏ I use a PC regularly in my instrumentation system
...
❏ I develop virtual instrumentation applications
...
Which statement best describes your function in the company? (check only one) ❏ Education ❏ Calibration ❏ Government/legal ❏ Production test ❏ Manufacturing/ automation ❏ Engineering management ❏ Research/R&D/grad student ❏ Systems integrator/ hardware ❏ Reseller/sales ❏ Purchasing/contracts ❏ Software developer ❏ Software consultant ❏ Service/repair ❏ Student/co-op ❏ Design ❏ Compliance testing Please Check Below for Free Product Information Software Tools ❏ Instrupedia™/Windows (CD) – includes catalogue, software demos, application notes, and more ❏ Software Showcase/Windows and Macintosh (CD) – Demos of entire software line ❏ DAQ Designer™/Windows (3
...
) – DAQ system integration tool Catalogues and Newsletters ❏ Measurement and Automation Catalogue ❏ Automation View™ newsletter ❏ VXI Product Solutions Guide ❏ Third-Party Solution CD ❏ Academic Catalogue ❏ NI News e-mail newsletter ❏ Instrumentation Newsletter™ Industry-specific Literature ❏ Aerospace ❏ Semiconductor ❏ Analytical chemistry ❏ Industrial automation ❏ Telecommunications ❏ Vibration/acoustics ❏ Education ❏ Laboratory automation ❏ Automotive ❏ Physiology ❏ Test and measurement Product Literature (check up to three) ❏ LabWindows/CVI ❏ Analysis ❏ GPIB ❏ PXI™ ❏ ComponentWorks ❏ HIQ ❏ GPIB chip kit ❏ IMAQ ❏ TestStand™ ❏ Measure ❏ HS488™ ❏ Customer education ❏ LabVIEW Add-On Toolkit pack ❏ LabVIEW productivity study ❏ Virtual instrumentation software ❏ Computer-based instruments ❏ BridgeVIEW ❏ DAQ ❏ VXI ❏ Lookout ❏ Low-cost DAQ ❏ VME ❏ SCXI signal conditioning Additional Literature ❏ NI Global Services ❏ LabVIEW Technical Resource Subscription Card ❏ Customer Education Course Schedule 11500 North Mopac Expressway Austin, TX 78759-3504 Tel: 512-794-0100, (800) 433-3488 • Fax: 512-683-9300 info@ni
...
com Product and company names mentioned herein are trademarks or trade names of their respective companies
...
All rights reservedTitle: LabVIEWTM Basics I Course Manual
Description: This course manual teaches you how to use LabVIEW to develop test
and measurement, data acquisition, instrument control, datalogging,
measurement analysis, and report generation applications