Sie sind auf Seite 1von 22

Lesson 3 Troubleshooting and Debugging VIs

LabVIEW Help Utilities


Correcting Broken VIs Debugging Techniques

Undefined or Unexpected Data


Error Checking and Error Handling

A. LABVIEW HELP UTILITIES CONTEXT HELP


Displays basic information about LabVIEW objects when you move the cursor over each object Select HelpShow Context Help, press <Ctrl-H> or click the Show Context Help Window button on the toolbar

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 HelpSearch 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

A. LABVIEW HELP UTILITIES NI EXAMPLE FINDER

Exercise 3-1: Using Help


Concept Exercise Become familiar with using the Context Help window, the LabVIEW Help, and the NI Example Finder.

B. CORRECTING BROKEN VIS

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

C. DEBUGGING TECHNIQUES
Your VI isnt 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?

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

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 OperateSuspend When Called from the shortcut menu

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

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

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

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

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 FileVI Properties and select Execution from the Category pulldown menu to disable automatic error handling for a specific VI

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

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

17

Exercise 3-2: Debugging


Concept Exercise Use the debugging tools built into LabVIEW.

SUMMARY QUIZ
1. How do you disable automatic error handling?
a) b) c)
d)

Select OperateDisable Error Handling Enable execution highlighting Wire the error out cluster of a subVI to the error in cluster of another subVI Place a checkmark in the Show Warnings checkbox of the Error List dialog box

19

SUMMARY QUIZ ANSWER


1. How do you disable automatic error handling?
a) b) c)
d)

Select OperateDisable Error Handling Enable execution highlighting Wire the error out cluster of a subVI to the error in cluster of another subVI Place a checkmark in the Show Warnings checkbox of the Error List dialog box

20

SUMMARY QUIZ
2. Which of the following are the contents of the error cluster?
a) b) c) d) Status: Boolean Error: String Code: 32-bit integer Source: String

21

SUMMARY QUIZ ANSWER


2. Which of the following are the contents of the error cluster?
a) b) c) d) Status: Boolean Error: String Code: 32-bit integer Source: String

22

Das könnte Ihnen auch gefallen