LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB Error Handler

Solved!
Go to solution

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.    

0 Kudos
Message 1 of 12
(3,975 Views)

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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 12
(3,965 Views)

I have to use GPIB that's the assignment. This is a small part of the project.

0 Kudos
Message 3 of 12
(3,960 Views)

@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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 12
(3,950 Views)

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.

0 Kudos
Message 5 of 12
(3,948 Views)

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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 12
(3,944 Views)

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?

 

0 Kudos
Message 7 of 12
(3,940 Views)

@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.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 12
(3,923 Views)

What would you put under the default?

0 Kudos
Message 9 of 12
(3,918 Views)

@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".



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 10 of 12
(3,899 Views)