Lab View Manual
Lab View Manual
NI Certification
The LabVIEW Core 1 course is part of a series of courses designed to build your proficiency
with LabVIEW and help you prepare for the NI Certified LabVIEW Associate Developer
exam. The following illustration shows the courses that are part of the LabVIEW training
series.
LabVIEW
LabVIEW LabVIEW LabVIEW Core 3
Getting Started Core 1 Core 2 Advanced
Architectures
LabVIEW
Connectivity in LabVIEW
LabVIEW
Performance Managing
Software
Engineering
Object-Oriented
in LabVIEW
Design &
Programming
in LabVIEW
B. Course Description
The LabVIEW Core 1 course teaches you programming concepts, techniques, features,
VIs, and functions you can use to create test and measurement, data acquisition,
instrument control, datalogging, measurement analysis, and report generation
applications. This course assumes that you are familiar with Windows and that you have
experience writing algorithms in the form of flowcharts or block diagrams.
The Participant Guide is divided into lessons. Each lesson contains the following:
• An introduction with the lesson objective and a list of topics and exercises.
• Slide images with additional descriptions of topics, activities, demonstrations, and
multimedia segments.
• A set of exercises to reinforce topics. Some lessons include optional and challenge
exercises.
• A lesson review that tests and reinforces important concepts and skills taught in the
lesson.
C. What You Need to Get Started
Before you use this course manual, make sure you have all of the following items:
DAQmx 14 or later
A GPIB cable
NI-488.2 14 or later
LabVIEW Core 1 course CD, from which you install the following folders:
E. Course Goals
This course prepares you to do the following:
• Understand front panels, block diagrams, icons, and connector panes
• Use the programming structures and data types that exist in LabVIEW
• Use various editing and debugging techniques
• Create and save VIs so you can use them as subVIs
• Display and log data
• Create applications that use plug-in DAQ devices
• Create applications that use serial port and GPIB instruments
1 Navigating LabVIEW
1 Navigating
LabVIEW
In this lesson you will learn to recognize the main components of the LabVIEW environment and be able
to create a new project and VI.
Topics
+ What is LabVIEW?
+ Project Explorer
+ Parts of a VI
+ Front Panel
+ Block Diagram
+ Searching for Controls, VIs, and Functions
Exercises
Exercise 1-1 Concept: Exploring a VI
Exercise 1-2 Concept: Locating Controls, Functions, and Vis
A. What is LabVIEW?
Objective: Recognize benefits of LabVIEW.
LabVIEW is a graphical programming environment you can used to develop sophisticated measurement,
test, and control systems.
Benefits of LabVIEW
• A platform-based approach for measurement and control
• Interfaces with wide variety of hardware
• Scales across different targets and operating systems • Provides built-in analysis libraries
LabVIEW Language Characteristics
Dataflow-oriented Object-oriented
Data-driven, or data-dependent. The flow of data between Allows a variety of similar, yet different items, to be
nodes in the G code determines the execution order. represented as a class of objects in software.
Compiled Multi-target
Compiles G code directly to machine code. Targets multicore processors and other parallel hardware
such as field-programmable gate arrays (FPGAs).
Multi-platform Memory-managed
Is portable between LabVIEW on different operating Provides you with options for improving performance.
systems.
Synchronous
Event-driven
Allows the user's direct interaction with the program
without the need for polling.
B. Project Explorer
Objective: Recognize the main components of the Project Explorer.
Project Explorer Projects in LabVIEW consist of VIs, files necessary for those VIs to run properly, and
supplemental files such as documentation or related links. Use the Project
Explorer window to manage projects in
LabVIEW. A LabVIEW project is denoted by a project file (.lvproj)
LabVIEW Files
Listed below are some of the characteristics of a LabVIEW project.
• Manages project files
• Deploys programs to remote embedded targets such as NI CompactRIO
• Creates stand-alone executables and installers for distribution
• Makes it possible to distribute code to developers and create shared libraries
• Can integrate LabVIEW programs with source code control software such as Perforce
When you add another target to the project, LabVIEW creates an additional item in the Project
Explorer window to represent the target. Each target also includes Dependencies and Build
Specifications sections. You can add files under each target.
1 2 3 4
8 7 6 5
Adds a directory on disk to the project Organizes project items and does not represent files on
disk
LabVIEW continuously monitors and updates the folder Can convert a virtual folder to an auto-populated
according to changes made in the project and on disk folder.
B. Parts of a VI
Is the user interface. Contains the graphical source Represents the VI and makes it
code. possible to use the VI as a subVI.
Has controls (inputs) and Contains terminals for front Maps the inputs and outputs to
indicators (outputs). panel controls and indicators. the VI.
E. D.Front Panel
F. Objective: Recognize the components and functionality of the Front Panel window and
select appropriate controls and indicators
G. Front Panel User interface for the VI. Contains controls and indicators, which are the
interactive input and output terminals of the VI, respectively.
H. Front Panel Window Toolbar
I. Use the front panel window toolbar buttons to run and edit the VI.
Controls and Indicators
Controls Indicators
Knobs, push buttons, dials, and other inputs Graphs, LEDs, and other displays
Simulate instrument input devices and supply data to Simulate instrument output devices and display data
the block diagram the block diagram acquires or generates
Goal
For each scenario, determine the appropriate data type and whether the front panel object should be a control or indicator.
E. Block Diagram
Objective: Recognize features of the Block Diagram and be able to select functions.
Block Diagram Block diagram objects include terminals, subVIs, functions, constants, structures, and
wires, which transfer data among other block diagram objects.
Block Diagram Toolbar
When you run a VI, buttons appear on the block diagram toolbar that you can use to debug the VI.
Component Description
Terminals Terminals are the entry and exit ports that exchange information between the front
panel and block diagram. You can view terminals as icon conserve space.
Nodes Nodes are objects on the block diagram that have inputs and/or outputs and perform
operations when a VI runs. Nodes are analogous to statements, operators, functions, and
subroutines in text-based programming languages. Nodes can be functions, subVIs, or
structures.
Function Nodes Functions are fundamental operating elements of LabVIEW and do not have front panels
(Functions) or block diagrams. Function icons have pale yellow backgrounds.
SubVIs SubVIs are VIs that run on the block diagram of another VI. They have front panels
and block diagrams. Any VI has the potential to be used as a subVI. When you
double-click a subVI, the front panel and block diagram open.
Use the icon from the upper-right corner of the front panel as the icon that
appears when you place the subVI on a block diagram.
Connector Pane The connector pane is the map of inputs and outputs of a VI
The connector pane terminals correspond to the controls and indicators on the
front panel of the VI. You cannot access the connector pane from the block diagram
window.
Express VIs
Express VIs are a type of subVI that you configure with dialog boxes. Icons for Express VIs appear on the
block diagram as icons surrounded by a blue field.
Wires
1 1
Wires transfer data between block diagram objects. A broken wire appears as a dashed black line with a
red X in the middle. You cannot run a VI that contains a broken wire.
Broken wires occur for a variety of reasons, such as when you try to wire two objects with incompatible
data types.
Common Wire Types
Boolean Green
String Pink
To toggle display of the Context Help window select Help»Show Context Help, press the <Ctrl-H> keys,
or click the Show Context Help Window button on the toolbar.
Functions Palette
The Functions palette contains the VIs, functions and constants you use to create the block diagram. Select View»
Functions Palette to display it.
Navigate the sub palettes or use the Search button to search the Functions palette.
Figure 1-4. Functions Palette
2 Creating your
First
application
A.Dataflow
Objective: Recognize characteristics of dataflow on the block diagram.
Dataflow Dataflow is the movement of data through the nodes of a block diagram.
Description: Work through this exercise on your own first, and then as a class, we will discuss
how data flow determines execution order. You can find answers to these questions following
this section.
Figure 2-1. Dataflow: Example A
2. an error wire connects the Express VIs. Which Express VI executes last?
Figure 2-3. Dataflow: Example C
Controls
Boolean controls have six types of mechanical action that allow you to customize Boolean
objects to create front panel windows that more closely resemble the behavior of physical
instruments.
Complete the multimedia module, Mechanical Actions of Boolean Controls, available in the
<Exercises>\LabVIEW Core 1\Multimedia\ folder.
Strings
A string is a sequence of displayable or non-displayable ASCII characters. Strings provide a
platform-independent format for information and data. Some of the more common applications
of strings include the following:
• Creating simple text messages.
• Controlling instruments with text commands
• Storing numeric data to disk. To store numeric data in an ASCII file, first convert data to
strings.
Instructing or prompting with dialog boxes
• Right-click a string control or indicator on the fr ont panel to select from the display type.
Navigating
Demonstration: Enums
Enums give users a list of items from which to select. Enums are useful because they make
strings equivalent to numbers, which are easy to manipulate on the block diagram. Each item
represents a pair of values: a string value and a 16-bit integer.
W Other Data Types
Scrolling
Use the Scrolling tool to scroll through windows
without using scrollbars.
Color Copy
Use the Color Copy tool to copy colors for pasting
with the Coloring tool.
Coloring Use the Coloring tool and the color picker to color
an object. The Coloring tool displays the current
foreground and background color settings. Select
the Coloring tool and right-click an object or
workspace to display the color picker.
Building a Basic VI
Express VIs are designed specifically for completing common, frequently used operations.
On the Functions palette, the Express VIs are grouped together in the Express category. Express VIs use
the dynamic data type to pass data between Express VIs.
Simulate Signal
Generates simulated data such as a sine wave.
Read from Reads a file that was created using the Write To
Measurement Measurement File Express VI. It specifically reads
File LVM or TDM file formats.
This Express VI does not read ASCII files.
VI Icon Description
2. Analyze: Circle the Express VI that is best suited to determining the average value of the acquired data.
3. Visualize: Circle the Express VIs and/or indicators that are best suited to displaying the data on a graph and
logging the data to file.
Build Text The Build Text Express VI creates text, usually for
displaying on the front panel window or exporting to a
file or instrument.
Waveform Graph
The waveform graph displays one or more plots of
evenly sampled measurements.
3 Troubleshooting and
Debugging VIs
If the Run button appears broken when you finish wiring the block diagram, the VI is broken and cannot
run.
Example Cause
Debugging Tips
The following table includes a few common problems to look for when debugging your VIs.
Breakpoints
Use the Breakpoint tool to place a breakpoint on a VI, node, or wire and pause execution at that location.
When you reach a breakpoint during execution, the VI pauses and the Pause button appears red. You can
take the following actions:
• Single-step through execution using the single-stepping buttons
• Probe wires to check intermediate values
• Change the values of front panel controls.
• Click the Pause button to continue running to the next breakpoint or until the VI finishes running.
C. Error Handling
Objective: Describe the difference between automatic and manual error handling.
Error Handling Review
Enabling automatic error handling does not override manual error handling. If the error cluster is wired
and the VI uses the Simple Error Handler, then LabVIEW defaults to manual error handling.
Error Clusters
VIs and functions return errors in one of two ways—with numeric error codes or with an error cluster.
Typically, functions use numeric error codes, and VIs use an error cluster, usually with error inputs and
outputs. Use the error cluster controls and indicators to create error inputs and outputs in subVIs.
#
4 using loop
A. Loops Review
Objective: Recognize loop structures and explain how to use them.
While Loops—Review
• Similar to Do Loop or a Repeat-Until Loop
• Repeats code segment until a condition is met
• Always execute at least once
• Iteration terminal—output that contains the number of complete iterations
Code
No Repeat (code);
Condition Until Condition met;
Code
met?
End;
Yes
End
C.For Loops
Objective: Demonstrate how to add a conditional terminal to a For Loop and describe how numeric
conversion occurs on the For Loop count terminal.
Conditional Terminal
You can add a conditional terminal to configure a For Loop to stop when a Boolean
condition or an error occurs. A For Loop with a conditional terminal executes until the
condition occurs or until all iterations are complete, whichever happens first.
The following For Loop generates a random number every second until 100 seconds has
passed or until the user clicks the stop button.
2
1 Right-click the loop border and select Condi tional Terminal from the shortcut menu.
2 Red glyph appears in the count terminal and a conditional terminal in the lower right corner.
C.For Loops
Objective: Demonstrate how to add a conditional terminal to a For Loop and describe how numeric conversion occurs
on the For Loop count terminal.
Conditional Terminal
You can add a conditional terminal to configure a For Loop to stop when a Boolean condition or an error
occurs. A For Loop with a conditional terminal executes until the condition occurs or until all iterations are
complete, whichever happens first.
The following For Loop generates a random number every second until 100 seconds has passed or until the
user clicks the stop button.
1 Right-click the loop border and select Condi tional Terminal from the shortcut menu.
2 Red glyph appears in the count terminal and a conditional terminal in the lower right corner.
Count Terminal Numeric Conversion
If you wire a double-precision, floating-point numeric value to the count terminal, LabVIEW converts the numeric
value to a 32-bit signed integer.
D.Timing a VI
Objective: Identify scenarios that require loop timing and apply the appropriate function
Wait Until Next ms Multiple Monitors a millisecond counter and waits until the millisecond counter
reaches a multiple of the amount you specify. This function is synced to
the system clock.
Waits until the millisecond counter counts to an amount equal to the
Wait (ms)
input you specify
Waveform Chart
The waveform chart is a special type of numeric indicator that displays one or more plots of data typically
acquired at a constant rate. Waveform charts can display single or multiple plots.
A.Arrays
Objective: Identify when to use arrays and learn how to create and initialize arrays.
Arrays
Array Collection of data elements that are of the same type.
Elements The data that make up the array. Elements can be numeric, Boolean, path,
string, waveform, and cluster data types.
Dimension Length, height, or depth of the array. Arrays can have one or more dimensions
and
as many as (231)-1 dimensions.
5 Creating and
Leveraging data
structures
1 D and 2D
Arrays can have multiple dimensions.
• 1D array:
For example, LabVIEW represents a text array that lists the twelve months of the year as a 1D array
of strings with twelve elements. Index is zero-based, which means the range is 0 to n- 1, where n is
the number of elements in the array. For example, n = 12 for the twelve months of the year, so the
index ranges from 0 to 11. March is the third month, so it has an index of 2.
• 2 D array :
Column Index
0 1 2 3 4 5 6 7
0
1
2
3
4
5
6
7
2 D Arrays
A 2D array stores elements in a grid. It requires a column index and a row index to locate an element,
both of which are zero-based.
Initializing Arrays
An uninitialized array contains a fixed number of dimensions but no elements. An initialized defines the
number of elements in each dimension and the contents of each element.
Complete the multimedia module, Common Array Functions, available in the <Exercises>\LabVIEW
Core 1\Multimedia\ folder.
Initialize Array
Creates an n-dimensional array in which every element is initialized to the value of element.
D.Auto-Indexing
Objective: Use auto-indexed inputs and outputs to create graphs and arrays.
Auto-Indexing
If you wire an array to or from a For Loop or While Loop, you can link each iteration of the loop to an element in
that array by enabling auto-indexing. The tunnel image changes from a solid square to the image to indicate auto-
indexing.
2
1 3
1 Right-click the tunnel and select Enable Indexing or Disable Indexing to toggle the state of
the tunnel.
2 Auto-indexed output arrays are always equal in size to the number of iterations.
3 Only one value (the last iteration) is passed out of the loop when auto-indexing is disabled.
Waveform Graphs
A waveform graph collects the data in an array and then plots the data to the graph.
1 The inner loop creates the column elements and the outer loop creates the row elements.
Auto-Indexing Input
Use an auto-indexing input array to perform calculations on each element in an array. If you wire an array
to an auto-indexing tunnel on a For Loop, you do not need to wire the count (N) terminal.
I
1 2
1 The For Loop executes the number of times e qual to the number of elements in the array.
2 If the iteration count terminal is wired and arrays of different sizes are wired to auto-indexed tunnels, the actual number of
iterations becomes the smallest of the choices.
1 The For Loop iterates 5 times and because the iterations ar e zero-based, the output is 4.
E. Clusters
Objective: Identify when to use clusters and be able to create them.
Clusters
Cluster Order
Cluster elements have a logical order unrelated to their position in the shell. The cluster order
determines the order in which the elements appear as terminals on the Bundle and Unbundle
functions on the block diagram.
You can view and modify the cluster order by right-clicking the cluster border and selecting
Reorder Controls In Cluster from the shortcut menu.
Autosizing Clusters
Autosizing helps you arrange elements in clusters.NI recommends the following:
• Arrange cluster elements vertically.
• Arrange elements compactly.
• Arrange elements in their preferred order.
Disassembling Clusters
Use the Unbundle and Unbundle By Name functions to return individual cluster elements.
12
Modifying a Cluster
Use Bundle By Name whenever possible to access elements in a cluster. Use Bundle when some
or all cluster elements are unnamed.
I
Multi-plot Graphs/Charts and XY Graph
The Bundle function is often used to create multi-chart plot charts and XY plots. The Build
Array function is used to create multi-plot waveform graphs.
Plotting Data
Use the Context Help window to determine how to wire multi-plot data to Waveform Graphs,
Charts and XY Graphs.
Error Clusters
LabVIEW contains a custom cluster called the error cluster. LabVIEW uses error clusters to pass error
information.
F. Type Definitions
Objective: Identify and determine when to use a type definition, strict type definition, or control.
Control Options
Use custom controls and indicators to extend the available set of front panel objects and to make them available
on other front panels.
Additional Resources
Boolean
A newly-created Case structure defaults to a
Boolean input.
The Case Structure includes a True case and a False
Case.
Integer
Case Structure has any number of cases.
Specify a Default case.
The numeric representation of the integer input
will determine the range of possible values for the
Case Selector Label.
You can specify ranges of values for the Case
Selector Label.
Use Radix option in shortcut menu to specify
whether the Case Selector Label displays values in
decimal, hexadecimal, octal, or binary.
String
Case Structure has any number of cases.
Specify a Default case.
By default, string values are case sensitive.
Shortcut menu includes option for Case
Insensitive Match for the string text.
Enum
Possible to ensure that the Case Structure
includes a case for every item in the enum.
Right-click the border of the Case Structure and
select Add Case for Every Value to create a case
for every item.
Error Cluster
Case Structure includes an Error Case and a No
Error Case.
Wire an error cluster to the terminal to execute
code if there is no error and skip code if there is
an error.
Numeric 0
Boolean FALSE
String
empty ( "" )
Event-Driven Programming
Objective: Recognize basic features and functionality of event structures.
Think about the VIs that you will need to develop at your job.
Will you use event-based programming to implement any of your VIs? Why or why not?
Additional Resources
Events in LabVIEW
Deciding whether to use events Caveats and Recommendations when Using Events in
LabVIEW
Modularity The degree to which a program is composed of discrete modules such that a change
tonne module has minimal impact on other modules. Modules in LabVIEW are
called subVIs.
Sub VI A VI used within another VI.The degree to which a program is composed of discrete
modules such that a change tonne module has minimal impact on other modules.
Modules in LabVIEW are called subVIs.
SubVIs—Reusing Code
SubVIs are similar to a subroutine in text-based programming languages. Use subVIs when you
have code that performs identical operations on different parts of your block diagram or in
another VI.
SubVIs
The following pseudo-code and block diagrams demonstrate the analogy between subVIs and
subroutines.
B. Icon
Objective: Recognize characteristics of a good icon and use the LabVIEW Icon Editor to create
a custom icon.
Purpose of Icon
This icon displayed in the upper right corner of the front panel is the same as the icon that
appears when you place the VI on the block diagram.
Connector Pane A set of terminals that correspond to the controls and indicators of that VI, similar
to the parameter list of a function call in text-based programming languages.
The connector pane defines the inputs and outputs you can wire to the VI so
you can use it as a subVI.
Patterns
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. The connector pane is displayed next to the icon on the front panel
window. You can select from many different patterns depending on how many inputs and
outputs are required.
Assigning Terminals
Click the connector pane terminal and then click the front panel control or indicator to assign
the terminal.
1 5
2
6
3
4 7
Standards
The standard connector pane, shown in the following figure is 4 x 2 x 2 x 4.
Use the following guidelines when assigning connector pane terminals:
• References on the top
• Error clusters on the bottom
• Inputs on the left
• Outputs on the right
• Unused terminals can be assigned later if you modify the VI
D. Documentation
Objective: Explain how to document code in LabVIEW using descriptions and tip strips, and describe
four methods for documenting code on the block diagram.
2
1
E. Using SubVIs
Objective: Demonstratehow to place subVIs on the block diagram, explain terminal settings and
error handling, and create subVIs from a section of existing code.
In the Context Help window, terminal labels appear differently depending on their setting.
Appearance Meaning Description
Bold Required The block diagram containing the subVI will be broken if you do
not wire the required inputs.
Plain Recommended
The block diagram containing the subVI can execute if you do
not wire the recommended or optional
Dimmed Optional terminals. If you do not wire the terminals, the VI does not
generate any warnings.
Handling Errors
Use a Case structure to handle errors passed into the subVI.
Convert a Section of a VI to a SubVI
Simplify your block diagram by converting sections of the block diagram into subVIs.
1. Select the section of the block diagram to convert.
2. Select Edit»Create SubVI.
3. Double-click the icon to open the subVI and edit the icon and connector pane.
Additional Resources
8 Acquiring
measurements
from hardware
A. Measurement Fundamentals with NI DAQ Hardware
Objective: Recognize the components of a DAQ system and practice connecting to hardware.
Sensor Phenomenon
Microphone Sound
Accelerometer Acceleration
pH probe pH
Implementation
Complete the following steps to examine the configuration for the DAQ device in the computer
using MAX. Use the test routines in MAX to confirm operation of the device. If you do not have
a DAQ device, you can simulate a device using the instructions in step 3.
1. Launch MAX by selecting Start»Programs»NI MAX or by double-clicking the NI MAX icon on
your desktop. MAX searches the computer for installed National Instruments hardware and
displays the information.
2. If you have a DAQ device installed, skip step 3 and go to the Examining the DAQ Device
Settings section.
3. Create an NI-DAQmx simulated device to allow you to complete the exercises without
hardware.
Right-click Devices and Interfaces and select Create New from the shortcut menu.
In the Create New dialog box, select Simulated NI-DAQmx Device or Modular
Instrument.
A terminal block consists of screw or spring terminals for connecting signals or other sensors.
A cable transports the signal from the terminal block to the DAQ device.
MAX displays National Instruments hardware and software in the computer. The device alias
appears in quotes following the device type. The Data Acquisition VIs use this device alias to
determine which device performs DAQ operations. MAX also displays the attributes of the
device such as the system resources that the device uses. Figure 8-2 shows the simulated
PCI-6225 device.
3. Select the Device Routes tab at the bottom of MAX to see detailed information about the
internal signals that can be routed to other destinations on the device, as shown in Figure 8-
3. This is a powerful resource that gives you a visual representation of the signals
that are available to provide timing and synchronization with components that are on the
device and other external devices.
Device Routes
4. Select the Settings tab, as shown in Figure 8-4, to see information about the last time the
device was calibrated both internally and externally. Not all devices contain calibration
information.
Calibration
5. If you are using a physical device, right-click the NI-DAQmx device in the configuration tree
and select Self-Calibrate to update the built-in calibration constants and calibrate the DAQ
device using a precision voltage reference source. When the device has been calibrated,
information in the Self-Calibration section updates. Skip this step if you are using a simulated
device.
2. Click the Test Panels button to test the individual functions of the DAQ device, such as analog
input and output. The Test Panels dialog box appears.
Use the Analog Input tab to test the various analog input channels on the DAQ device.
Click the Analog Input tab. Click the Start button to acquire data from analog input
channel 0 and click the Stop button when you finish.
– If you are using the BNC-2120, make sure the switch over the AI 0 connector is in the
Temp. Ref. position to connect the temperature sensor to ai0. Place your finger on
the sensor to see the voltage rise.
– If you are using a simulated device, a sine wave is shown on all input channels.
Use the Analog Output tab to set up a single voltage or sine wave on one of the DAQ
device analog output channels. Click the Analog Output tab.
– Select Sinewave Generation in the Mode drop-down menu and click the Start
button. MAX generates a continuous sine wave on analog output channel 0.
– If you have hardware installed, you can read the sine wave that channel 0 outputs.
On the BNC-2120, wire Analog Out Ch0 to Analog In Ch1. Click the Analog Input tab
in the Test Panels dialog box and select Dev1/ai1 from the Channel Name drop-down
menu. Click the Start button to acquire data from analog input channel 1 . MAX
displays the sine wave from analog output channel 0.
Use the Digital I/O tab to test the digital lines on the DAQ device. Click the Digital I/O
tab.
– In the Select Direction section, set lines 0 through 3 as output as shown in Figure 8-
5.
Digital I/O Line Direction
– Click Start to begin the digital output test, then toggle the switches in the Select State
section shown in Figure 8-6. If you have a BNC-2120, toggling the switches turns the
LEDs on or off. Notice that the LEDs use negative logic.
Digital I/O Switches
Use the Counter I/O tab to determine if the DAQ device counter/timers are functioning
properly. Click the Counter I/O tab.
– If you have hardware installed, you can verify counter/timer operations by selecting
Edge Counting from the Mode drop-down menu and clicking the Start button. The
Counter Value indicator increments rapidly. Click Stop to stop the counter test.
Click the Close button to close the Test Panel dialog box and return to MAX.
Access MAX by double-clicking the NI MAX desktop icon or selecting Tools»Measurement &
Automation Explorer in LabVIEW.
Connecting Using LabVIEW DAQmx VIs
The LabVIEW DAQmx VIs let you control your hardware with finer options then the DAQ
Assistant Express VI. The DAQmx VIs also let you make the measurement or generation you
want to perform globally accessible from any application.
Hardware connectivity The physical cable connecting the instrument. Also, the
communication protocol, or bus.
Initialize The Initialize VI establishes communication with the instrument and is the first
instrument driver VI called.
Configure Configure VIs are software routines that configure the instrument to perform specific
operations. After calling these VIs, the instrument is ready to take measurements or
stimulate a system.
Action/Status Action/Status VIs command the instrument to carry out an action (for example,
arming a trigger) or obtain the current status of the instrument or pending operations.
Utility Utility VIs perform a variety of auxiliary operations, such as reset and self-test.
Close The close VI terminates the software connection to the instrument. This is the last
instrument driver VI called.
9 Accessing Files in
labview
A.Accessing Files from LabVIEW
Objective: Identify the steps for writing and reading files from a LabVIEW application.
1 2 3 4
Perform three steps of the file I/O process. Perform one step of the file I/O process.
( open/write/close )
Create unnecessary resource overhead when used in loops. Save memory resources when used in loops.
Are good to use when writing to a file in a single operation. Are good to use when streaming data to disk.
1 2 3 4
File Refnums
File refnums identify unique file I/O sessions.
String Functions
To write data to a text file, you must first convert the data into a string data type. Use the items
from the String palette to convert numerics and other data types to text.
C.Comparing File Formats
Objective: Recognize different options for logging data to disk.
Easily Exchangeable X X X
Inherent attributes X X
High-speed streaming X
File Formats for file I/O Determining Which File Format to Use
Flow-Through Parameters
To enforce sequential programming in LabVIEW, you can complete sequential tasks by placing
each task in a separate subVI, and wiring the subVIs in the order you want them to execute using
the error cluster wires.
However, in this example, only two of the tasks have a error cluster. Using the error clusters,
you can force the execution order of the two DAQ Assistants, but not the One Button Dialog
functions, as shown in the following figure.
Sequence Structures
A Sequence structure contains one or more subdiagrams, or frames, that execute in sequential
order; a frame cannot begin execution until everything in the previous frame has completed
execution.
State Part of a program that satisfies a condition, performs an action or waits for an event.
C. State Machines
Objective: Determine when to use a state machine.
Sequential Process
• A state represents each segment of the process.
• Depending on the result of each state’s test, a different state might be called.
• Can happen continually, resulting in an in-depth analysis of the process you are testing
UI-Driven Process
• Different user actions process different code and act as a state in the state machine.
• Each segment can lead to another segment for further processing or wait for another user action.
• The state machine constantly monitors the user for the next action to take.
Multimedia: Building State Machines
Complete the multimedia module, Building State Machines, available in the
folder to learn about the following topics.
• State Machine Infrastructure
• State Machine Transitions
– Single Default
– Select Function
– Case Structure
– Transition Array