LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a LabView example in the use of user defined error codes?

Specifically, I have a VI that tests four arrays of data against various high/low limits. I have pass/fail outputs for 18 tests. I'd like to combine these into an 'error out' cluster with appropriate error codes and messages, for which I've created an x-errors.txt file.

My first question must be trival - how do I just set the 'status' bit of the error stream to let the general error handler then look up the error desription from the file?

Secondly - I can't find an example of this in the technical resourses, amI missing something?

Thanks,
Mike
Mike Evans
TRW Conekt
N.I. Alliance Member, UK
http://www.Conekt.net
0 Kudos
Message 1 of 4
(3,207 Views)
There is no example program. There is extensive help on how to do this. Here's the basics.

1) There are two ways to define user error codes in LV6.1. If you are using LV6.0 or earlier, only one method is possible.
2) The 6.0 method involves wiring arrays of error codes and arrays of error code strings to the General Error Handler.vi. These codes will be used to explain any error code which is undefined in LV's internal error code database. Error codes reserved for users which are guaranteed not to be used by NI are from 5000 to 9999.
3) The 6.1 method allows you to create a specially formatted error code file on disk that will be merged with the LV error code database each time LabVIEW launches. For help on this, go to LV's online help, and in t
he Index tab, type
"user-defined error codes, in text files"
(without the quote marks)
4) If you want to set an error into the error cluster, use the General Error Handler.vi again. Wire your error code value to the Error Code terminal (the leftmost-topmost corner terminal). Wire the name of your VI to the Error Source terminal, and wire "No Dialog" to the Type of Dialog terminal (left-side, near the bottom). The error code cluster that comes out of this VI will either be the error in (if one was set) or a new error code cluster with your error and the status bit set to TRUE.
5) The attached demo is written in LV6.0.
Message 2 of 4
(3,207 Views)
> My first question must be trival - how do I just set the 'status' bit
> of the error stream to let the general error handler then look up the
> error desription from the file?

If you want to manually create an error, you use the bundle by name
function in the clusters menu. Set the status flag to TRUE,
indicating an error, set the code to an error code number you choose,
and wire in a descriptive string to the source. This is where you can
lookup a text string, then insert it into the diagram. Then you
bundle the error cluster, and wire it to the rest of your diagram.
If you have Labview 6.0 or later, the help files have details under
the Debugging VI's\Error Checking & Error Handling. If you have an
earlier version of Labview, then use the link below to get
their Error
Code reference.

<>

A few words of caution. First, you should choose error codes in the
User Defined Error codes area, use the references above to make sure
you aren't using a previously defined error code. Second, you might
want to make the errors insert ONLY IF NO OTHER CODES EXIST, that way
you don't put a trivial error code over something important.
0 Kudos
Message 3 of 4
(3,207 Views)
Use the Merge Error.vi in LV6i and later to combine two independent error code clusters. This will prioritize the clusters based on the order you connect them. It will not, as David recommends in his post, prioritize a particular error code value over another, but it will choose the first error code found, and generally the time an error was created is more important, as the earlier error is what lead to later errors.

Also, if you do happen to use an already defined error code, the General Error Handler.vi will concatenate the two error code descriptions, so you'll know that it is one of these two meanings.
0 Kudos
Message 4 of 4
(3,207 Views)