8:43 pm
March 17, 2015
I’d like do error handling by outputting specific text to an LCD based on the type of error my VI generates. I understand the compiler supports the LabVIEW error cluster, but once I try to unbundle the error code and error source, I get a compilation error “'NamedUnbundler' was not declared in this scope” which seems to be related to the unbundle action. Why?
9:39 pm
March 12, 2015
Hi Rohit,
Even though the compiler won’t generate a compilation error if your target VI uses the LabVIEW error cluster, the error cluster is only used for data flow control. Its contents are meaningless within the scope of the compiler. Also, the compiler doesn’t support bundle/unbudle, as it doesn’t support clusters in general.
If you want to do error handling, you will need to use your own error handling mechanisms. I recommend using an error code only, simply stored in a numeric datatype. Pass that along your VI and use non-zero codes for any errors. If you require String errors, create a lookup table stored in a subVI to pull an error description based on the error code input. So when you must display the error code, check your error int, and if the value is non-zero, then call your lookup table to get the error string, and display that on your LCD. Will that work for you?
Please note that storing a bunch of string errors in a VI is very costly in terms of memory usage. What target are you on? If its something like the Uno with 2k of RAM, just be cautious of using a lot of string constants. Those will take up RAM. It would be much better to use an int only for error handling.
25
1 Guest(s)