LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to programmatically trap/process "Error -1074388991 occurred at NI-CAN Wait For State"

I'm using Labview 8.5 or 2012, with an NI-USB-8473 CAN interface, to communicate with an external device. 

Problem situation 1: Whenever I disconnect the CAN lines from my external device, I get this error code.  I can clear the code, then reconnect the external device and restart communications.  This disconnect of cabling is normal, since a user may be testing multiple devices in sequence, and so needs to power down/disconnect from the the CAN bus.

Problem situation 2: In another more unusual instance, when the USB is disconnected from the 8473, I get the same error code, but I'm unable to clear it with one key stroke.  I need to hold down the ENTER key on the keyboard indefinitely, while simultaneously clicking the STOP button on my Labview application.  This works most of the time, and then I can reconnect the USB and restart the Labview app successfully.

My question is:  How can I trap this activity programmatically, and even if I can, what can I do to correct it and make it transparent to the user? 

Thanks in advance.

0 Kudos
Message 1 of 3
(2,848 Views)

Hello The_General1,


Handling these NI-CAN errors can be done using conventional LabVIEW error handling techniques. Assuming you are manually handling the errors in your program, whenever you detect the errors you are worried about, you can handle them in a way that makes sense in your application. There are a multitude of different ways of accomplishing this.


For example, if the CAN lines are disconnected from the 8473, you could program your application to catch the error and move into a safe\paused state until the user reconnects the device to the CAN bus (state machine architecture would be useful here). You can develop your own error handling code, use general error handler libraries available on the web, or use a combination of both. Below is a link to the Structured Error Handler (SEH) Reference Library which you may find useful.

 

Structured Error Handler (SEH) Reference Library:
http://www.ni.com/example/31253/en/


Handling Errors in LabVIEW:
http://www.ni.com/getting-started/labview-basics/handling-errors


In the case where the USB cable is disconnected, a similar procedure can be followed. Manually catch the error, display it once to the user(if desired), and move the code to a safe\pause state that waits until the device is reconnected. If you want to be able to check if the device is connected programmatically, that may prove more difficult. Below is an example of how this could be done.

 

Check if a USB Device is Connected to the System - Windows Registry:
https://decibel.ni.com/content/docs/DOC-6743


How can I Monitor USB Device Connected to my pc Programmatically:
http://forums.ni.com/t5/LabVIEW/how-can-i-monitor-usb-device-connected-to-my-pc-programmatically/td-...


Regards,


j_bou

0 Kudos
Message 2 of 3
(2,823 Views)

Thanks, J_bou.   I'll take a look at this soon to try it.  I'll let you know how it goes.

0 Kudos
Message 3 of 3
(2,814 Views)