LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling Instrument Error States

I'm writing an instrument driver for a piece of equipment that can issue numerical error codes (such as parameter out of range, out of memory, etc.) I would like to catch these errors and make anyone using my code (a programmer, or an operator)aware that an error has occured. What is the best way to do this?
My thoughts so far:
-Can instrument errors be added to the Labview error handler in some way?
-I can write my own error handling vi that will check the error code after every command issued to the test instrument. I can then alert the user with a dialog box or write the error to perhaps a global variable somewhere.
Also, how do I keep track of where in the program an error has occurred? Knowing the sub-vi alone isn't much good
since the sub-vi could be used many times in a program. Is it possible to have something running in the background that monitors the GPIB service request line so that it can check for errors, or is it better to check for errors at specific points in the program. Any references to this topic in Labview manuals, white papers, etc. would be really great.
David Grucza, CLD
0 Kudos
Message 1 of 4
(3,062 Views)
See creating user defined error codes in the help for labview.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 4
(3,062 Views)
Imho, checking of instrument errors belongs in the recomended Prefix Error Query VI (where prefix is the instrument model). You should get the latest copy of the templates, guidelines, etc. from here. Do not put any range checking in the driver VIs themselves. The instrument itself should be able to determine if a value is out of range and the driver should be calling the error query function. You limit the driver by using LabVIEW for things likerange checking. As an example, say you've a power supplu model A with a max current of 5 amps. Someone tries to program it for 6 amps and the instrument should put a message in it's error queue that is read and the programmer fixes his program. Now, m
odel B of the same supply is released and it has a max current of 7 amps. If you had limited the current range in your driver, the driver would not be useable for the new model supply.

If you follow the guidelines, you'll have a much better chance that your instrument driver will be accepted by NI if that's your ultimate goal.
Message 3 of 4
(3,062 Views)
Imho, checking of instrument errors belongs in the recomended Prefix Error Query VI (where prefix is the instrument model). You should get the latest copy of the templates, guidelines, etc. from here. Do not put any range checking in the driver VIs themselves. The instrument itself should be able to determine if a value is out of range and the driver should be calling the error query function. You limit the driver by using LabVIEW for things likerange checking. As an example, say you've a power supplu model A with a max current of 5 amps. Someone tries to program it for 6 amps and the instrument should put a message in it's error queue that is read and the programmer fixes his program. Now, model
B of the same supply is released and it has a max current of 7 amps. If you had limited the current range in your driver, the driver would not be useable for the new model supply.

If you follow the guidelines, you'll have a much better chance that your instrument driver will be accepted by NI if that's your ultimate goal.
0 Kudos
Message 4 of 4
(3,062 Views)