Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 22

Lesson 3

Troubleshooting and Debugging VIs

TOPICS
A. LabVIEW Help Utilities
B. Correcting Broken VIs
C. Debugging Techniques
D. Undefined or Unexpected Data
E. Error Checking and Error Handling
ni.com/training
A. LabVIEW Help Utilities – Context Help
• Displays basic information about LabVIEW objects when
you move the cursor over each object
• Select Help»Show
Context Help, press
<Ctrl-H> or
click the Show Context
Help Window button
on the toolbar

ni.com/training
2
A. LabVIEW Help Utilities – LabVIEW Help
• Detailed descriptions of most palettes, menus, tools, VIs,
and functions and instructions for using LabVIEW features
• Accessing the LabVIEW Help:
− Select Help»Search the LabVIEW Help
− Use the Detailed help
link or button in the
Context Help window
− Right-click an object
and select Help from
the shortcut menu

ni.com/training
3
A. LabVIEW Help Utilities – NI Example Finder

ni.com/training
4
Exercise 3-1: Using Help

Concept Exercise
Become familiar with using the Context Help window, the
GOAL

LabVIEW Help, and the NI Example Finder.

ni.com/training
5
B. Correcting Broken VIs

ni.com/training
6
B. Correcting Broken VIs

Common Issues
• Broken wire
− You wired a Boolean control
to a String indicator
− You wired a Numeric control
to a Numeric control
• A required block diagram terminal is unwired
• A subVI is broken or you edited its connector pane after
you placed its icon on the block diagram of the VI

ni.com/training
7
C. Debugging Techniques

Your VI isn’t broken, but you are getting unexpected data or


behavior
• Any unwired or hidden subVIs?
• Incorrect default data being used?
• Undefined data being passed?
• Numeric representation correct?
• Node execution order correct?

ni.com/training
8
C. Debugging Techniques –
Execution Highlighting
• Use execution highlighting to watch the data flow through
the block diagram
• If the VI runs more slowly than expected, confirm that you
turned off execution highlighting in subVIs

ni.com/training
9
C. Debugging Techniques – Single Stepping

Single-step through the VI to view each action of the VI on


the block diagram
Suspend the execution of a subVI to edit values of controls
and indicators, to control the number of times it runs, or to go
back to the beginning of the execution of the subVI
• Open subVI and select Operate»Suspend When Called
from the shortcut menu

ni.com/training
10
C. Debugging Techniques – Probes
• Use the Probe tool to observe intermediate data
values and to check the error output of VIs
and functions, especially those performing I/O
• Retain the values in the wires so that you can
probe wires for data after execution has finished

ni.com/training
11
C. Debugging Techniques – Breakpoints
• When you reach a breakpoint during execution, the VI
pauses and the Pause button appears red
• You can take the following actions at a breakpoint:
− Single-step through execution using the single-stepping
buttons
− Probe wires to check intermediate values
− Change values of front panel controls
− Click the Pause button to continue running to the next
breakpoint or until the VI finishes running

ni.com/training
12
D. Undefined or Unexpected Data
• ∞ (Inf)
− Infinity
− Divided a number by zero?
• NaN
− Not a number
− Produced by invalid operations, such as taking the square
root of a negative number
• Check for unexpected Inf values or NaN values in your
mathematical operations

ni.com/training
13
E. Error Checking and Error Handling
• No matter how confident you are in the VI you create, you
cannot predict every problem a user can encounter
• Without a mechanism to check for errors, you know only
that the VI does not work properly
• Error checking tells you why and where errors occur
− Automatic error handling
− Manual error handling

ni.com/training
14
E. Error Checking and Error Handling –
Automatic Error Handling
• LabVIEW automatically handles any known error when a VI
runs by:
− suspending execution,
− highlighting the subVI or function where the error occurred,
− and displaying the Error dialog box
• Select File»VI Properties and select Execution from the
Category pull-down menu to disable automatic error
handling for a specific VI

ni.com/training
15
E. Error Checking and Error Handling – Manual
Error Handling
• To disable automatic error handling for a subVI or function,
wire its error out cluster to the error in cluster of another
subVI or function or to an error out indicator
• Use the LabVIEW error handling VIs,
functions, and parameters
to manage errors

ni.com/training
16
E. Error Checking and Error Handling – Error
Clusters
• Use the error cluster controls and indicators to create error
inputs and outputs in subVIs
• The error in and error out clusters include the following
components of information:
− Status
− Code
− Source

ni.com/training
17
Exercise 3-2: Debugging

Concept Exercise
Use the debugging tools built into LabVIEW.
GOAL

ni.com/training
18
Summary—Quiz

1. How do you disable automatic error handling?


a) Select Operate»Disable Error Handling
b) Enable execution highlighting
c) Wire the error out cluster of a subVI to the error in
cluster of another subVI
d) Place a checkmark in the Show Warnings checkbox of
the Error List dialog box

ni.com/training
19
Summary—Quiz Answer

1. How do you disable automatic error handling?


a) Select Operate»Disable Error Handling
b) Enable execution highlighting
c) Wire the error out cluster of a subVI to the error in
cluster of another subVI
d) Place a checkmark in the Show Warnings checkbox of
the Error List dialog box

ni.com/training
20
Summary—Quiz

2. Which of the following are the contents of the error


cluster?
a) Status: Boolean
b) Error: String
c) Code: 32-bit integer
d) Source: String

ni.com/training
21
Summary—Quiz Answer

2. Which of the following are the contents of the error


cluster?
a) Status: Boolean
b) Error: String
c) Code: 32-bit integer
d) Source: String

ni.com/training
22

You might also like