LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Frequent Crashes - Running, Exiting, While in Block Diagram...

I am suffering from frequent crashes and lockups of LabVIEW 8.5 Base version. I have not been able to pin down the root as the occurances may happen when my program is running , or when I try to exit, or when working in a block diagram. It seems like it is more likely to occur in and around vi's created using the dll conversion wizard. The vi's are for the API for Silicon Labs CP210x USB to UART configuration. In my test the device powered on an off several times and so appears and disappears several times, and this gets repeated as new devices are tested.

How do I track this down?
How do I practice "safe" programming to avoid unexpected occurances that crash LabView?
0 Kudos
Message 1 of 5
(2,929 Views)
Hi m_goss,
 
Thank you for contacting National Instruments.  I am unsure as to exactly what you are referencing as the DLL conversion wizard, but from what you are describing, I believe you are either turning LabVIEW code into a DLL or using the Call Library Function Node.  When using the Call Library Function Node, we should ensure that the DLL is thread safe so that we can avoid any crashes of LabVIEW.  This will require more memory, but is a good method to prevent any problems when interacting with LabVIEW.  A thread safe piece of code will function correctly during simultaneous execution by multiple threads. 
 
Also, LabVIEW won't ever automatically recognize errors unless the DLL was created in LabVIEW.  However, if I am incorrectly interpreting the information you have provided, and you have any error codes or messages that you are receiving, they could also be helpful in troubleshooting this issue.  I hope this is helpful!  Have a nice day!
 
Jason W.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 5
(2,902 Views)
Jason,
Thanks for your reply.
To clairify I took a dll provided by a part vendor that they wrote using C++ and converted it into a set of LabVIEW vi's using a wizard I stumbled into. These vi's have error in and error out connections I use to thread the operation. These vi's are used to program the device through a virtual COM port (via USB). I appears to me that the problem is related to the COM port disappearing and reappearing. I have more success if I pay attention to opening and closing the port rather than allowing it to just disappear. Other devices do not seem to be bothered by this or I have just been lucky with them. Perhaps they have better drivers with timeouts built in.  I am new to LabVIEW and I can believe that much of my misery is self inflicted but I would not expect LabVIEW to just fall over or hang.
When LabView is waiting for some response that will never come is there a way to stop the offending process or vi rather than shutdown or kill all of LabVIEW?
-->MG
0 Kudos
Message 3 of 5
(2,897 Views)

Hi MG,

Are you using the Import Shared Library Utility from Tools >> Import >> Shared Library (.dll)?  This is a tool within LabVIEW that can be used to convert shared libraries to VIs.

In response to your most recent question, by controlling or adding a timeout for the COM (USB) communication you would be able to stop a portion of the process or the entire VI. This is because when the timeout value is exceeded this initiates an error which will propagate to the subsequent code and prevent any further operations from executing.  In order to stop this error chain from continuing to the end of the code a General Error Handler VI can be used with the COM timeout error code wired to the 'exception code' terminal to ignore this error for future code execution.

Hopefully, this is a possible solution for your application.  If you need any further clarification, please let me know.

Jason W.

National Instruments
Applications Engineer
Message 4 of 5
(2,872 Views)
Jason,

To answer your questions:
I did indeed use Import Shared Library Utility from Tools >> Import >> Shared Library (.dll).
And, when I open the COM port using the VISA Config Serial Port, I am setting the timeout to 2000 msec. When I do something that fouls up communication the read and write commands do error out and release the program.

However, it is still possible, if the program has been stopped without closing ports or if the plug on the port gets pulled, for LabVIEW hang when attempting to exit and shut down LabVIEW (no program running). I have had to kill the LabVIEW process using the windows task manager on several occasions. Often though in this situation I have found that LabVIEW will get Unstuck and exit if I pull the plug on the offending USB device.
I am not having many problems now that I have made an effort to close ports before stopping LabVIEW.

My solution to all this was to create a vi that closes all of the ports my test uses, and load and run it if my program has been stopped abnormally, (such as during debugging). I have also asked our CM to reboot LabVIEW between batches of tests.

MG

0 Kudos
Message 5 of 5
(2,821 Views)