Example Code

Multiple Error Handler for LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

1. Overview

This example demonstrates an architecture for a subVI that can be called throughout an application to collect all possible errors that have occurred and report them in a list, in the form of an Array Indicator. The subVI is designed in the form of a Functional Global Variable.
The attached files contains a LabVIEW Project with a Main Top Level VI called 'Main Error Handling Development.vi'. The main VI exists to demonstrate the use of the subVI 'ErrorHandlerFunctionalGlobal.vi'.

2. Description

The 'Dialog and User Interface' palette in LabVIEW contains many error handler VIs, such as the 'Simple Error Handler.vi' or the 'General Error Handler.vi'. These are useful for reporting a single error that can occur within a LabVIEW VI. In certain applications, multiple Error Cluster wires are used, such as in parallel architectures, or where custom error codes are used. The 'Merge Errors.vi' exists to merge the Error Clusters together, however, it only reports the first error, as oppose to concatenate a list.
The Main VI in this example goes through a For Loop to simulate going through a Test Sequence. Each Test in the Sequence will report a custom Error Code which is bundled into the Error Cluster. To use the example, follow the instructions added in the Front Panel and Block Diagram.

3. Requirements

  • NI LabVIEW Base Development System 2012 (or compatible)

 

4. Steps to Implement or Execute Code

  1. Download and open the project "Multiple Error Handler LabVIEW 2012 NIVerified.lvproj"
  2. Open the VI "Main Error Handling Development.vi"
  3. Keep the default inputs on the Front Panel.
  4. Press Ctrl+E to switch to the Block Diagram.
  5. Select 'Highlight Execution'.
  6. Switch to the Front Panel and Run the VI.
  7. Observe the array Collection of Errors Output.
  8. Notice that the Output is an array of Custom Errors.
  9. Change the Boolean Statuses above and repeat.
  10. To use the Error Handler Sub-VI in your own application copy the contents of the 'Error Handler' Virtual Folder and paste it into your Project file.


5. Additional Information or References

ErrorHandlerFunctionalGlobal Screenshot.PNG

 

 

**The code for this example has been edited to meet the new Community Example Style Guidelines.**

George T.
Senior Applications Engineer
National Instruments UK and Ireland

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.