LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Handle hardware driver error with dialog box suppression

Dear experts,
In my low level VIs, I'm calling some functions from a DLL file (using the Call Library Function Node), in order to control a device connected through USB. Sometimes, during running, the USB driver of the device reports an error through a LabVIEW message box; then the VI remains suspended waiting for a user action on this dialog box. Unfortunately, no error is reported in the output error cluster of the Call Library Function Node.
I tried to disable the automatic error handling from the labVIEW option window, and also I tried to change the Error Checking Level of the Call Library Function Node. But I didn't manage to suppress the dialog box neither direct this error to the error cluster. It seems that it's recognised as a message, instead properly as an error.
Any idea?
Thanks in advance

0 Kudos
Message 1 of 4
(2,766 Views)

Hi Davide,

 

I was able to find this old forum thread that talks about handling errors in DLL's. Your problem appears to reflect the information from this post, so I suspect you still cannot pass exceptions from a DLL into LabVIEW. What is it that you would like to do? It seems you will need to error handle in the DLL itself and then you can use its return value to interface with LabVIEW.

 

I will keep looking, but if anyone can confirm that LabVIEW still exhibits this functionality, that would be appreciated. Also, out of curiosity, what error are you receiving?

 

Duncan W.

0 Kudos
Message 2 of 4
(2,742 Views)

Hi Duncan, 
the device is an I2C Master, that we use to control other slave devices calling some functions inside the DLL, such as "I2C_Read" or similar, which also return an integer as error code. Inside my block diagram I handle properly this error codes, generating my custom error cluster. Simplifying, the communication from LabVIEW goes through different layers:
DLL [function like: int I2C_Read(*parameters)] -> USB Driver -> Device
Now, the situation is the following:
1) If an error happens in the top layer (DLL) I get an error out of the Call Library Function, for example the error 1517 if I call the function as stdcall (WINAPI) or C.
2) If an error happens at the USB driver layer (for example if the device is not found) LabVIEW opens a dialog box, and no error is directed in the error cluster out from the Call Library Function.
3) If an error happens at the device layer (for example if the I2C communication fails for some reason, address not acknowledge or similar) the function returns an integer error code and clearly no error is directed out from the Call Library Function. In fact I handle manually these error codes, since they are low level errors.

My question is: is there a way to direct the 2nd layer error type into the first one? or to suppress the dialog box?
Thanks 

0 Kudos
Message 3 of 4
(2,701 Views)

Davide,

 

This is a very weird problem to be having. Are you sure that it is a LabVIEW error being thrown? I would not expect LabVIEW to have any communication with the driver if it is being called by your DLL. Based on what you have described, I would expect Windows itself to be handling any errors with the USB driver (especially a device not found error).

 

If you could provide your VI or a snapshot of the relevant code, that would be very helpful as we work towards resolving your issue. If you could include a picture of the error you are receiving, that would be helpful as well.

 

Duncan W.

0 Kudos
Message 4 of 4
(2,684 Views)