07-02-2018 11:49 AM
I am using a GPIB to control remote devices, I am trying to create an error handler for when the GPIB disconnects. AKA, if the device is shut off mid data collect, then MY error handler should display not LabVIEWs. I am using an not equal comparison with a case structure, but it seems to display whenever the devices is disconnect, even when it successfully collects all data.
I am trying to apply this to multiple devices, but the error does not activate until all devices are disconnected instead of detecting each separate device.
Solved! Go to Solution.
07-02-2018 12:09 PM
First of all, I see SCPI commands, which tells me you can use the VISA reads and writes instead of the old and outdated GPIB functions. There are about a zillion reasons why using VISA functions instead of the GPIB ones are better, but the one that applies in this specific case is that the VISA functions actually return error codes that you can handle. That simplifies your code a lot.
07-02-2018 12:14 PM
I have to use GPIB that's the assignment. This is a small part of the project.
07-02-2018 12:30 PM
@Jibica wrote:
I have to use GPIB that's the assignment. This is a small part of the project.
GPIB is just the communication bus. You can control a GPIB bus with VISA. Trust me, this does make life easier. The main reason I really like VISA is that you can use the same interface for RS-232, GPIB, and Ethernet. All that has to change is the initialization.
As far as handling the errors, you can do whatever you want with the information inside of the error cluster. Nothing says you have to use the General Error Handler or the wrapper around it: the Simple Error Handler. Chain your errors from function to function and do something with the error data at the end of your VI.
07-02-2018 12:49 PM
That is exactly my problem. I've tried to connect the error in to the error out between all the GPIB read/write functions but I don't understand how to get it to display the error/manipulate the error data. Are you referring to the Error Cluster from Error Code? I'm fiddling with the Display Message to user right now, but it's not displaying anything.
07-02-2018 01:03 PM
The error information is contained in the error cluster. So you can just use Unbundle By Name to pull out the information you need. Or you can just use the Simple Error Handler if all you want is a simple pop-up window.
07-02-2018 01:10 PM
Yes, I am trying to get simple popup window displaying the error that device1/device2 is disconnected and not LabVIEWs errors.
I am connecting the error out of the GPIB Read/Write to the error in of the Simple Error Handler, but nothing happens.
Any suggestions?
07-02-2018 01:53 PM - edited 07-02-2018 01:54 PM
@Jibica wrote:
Yes, I am trying to get simple popup window displaying the error that device1/device2 is disconnected and not LabVIEWs errors.
Well, that is a little different than using the Simple Error Handler. In that case, you have to diagnose the error yourself. To start off, I would use Unbundle By Name to get the error code. That error code is then used with a case structure to diagnose the error and create a string to display. Then after the case structure you can use a 1 Button Dialog function to show your error string.

07-02-2018 02:05 PM
What would you put under the default?
07-02-2018 03:09 PM
@Jibica wrote:
What would you put under the default?
Personally, I would use the Format Into String to make a string something along the lines of "Error 1234 occurred" and add on the error source string. The format I would use would be "Error %d occurred.\nError Source: %s".