02-03-2008 11:23 PM
02-04-2008 12:26 AM
Seems that it is something wrong with your code.
Probably some buffer overflows. See if the "flush buffer" helps.
If you can attach a simplify vi, with your code maybe we can say something more.
02-04-2008 01:11 PM
Hi Biomed_developer,
I also think it might be something in the code that is causing LabVIEW to hang. I would recommend posting a simplified version of your code or a screenshot of the block diagram to see if we can find something that might be causing the problem. Also, have you looked at the LabVIEW examples from the NI Example Finder? For instance, the Basic Serial Write and Read.vi. It might be a good idea to look at how this is set up. Also, try running this one for a while to see if LabVIEW freezes/hangs with the example one or if it is just your specific code. I hope this helps!
Carla
02-04-2008 01:43 PM
Thanks Pnt and Carla. Here's what I have done since posting the problem.
- For this device, I am not using Labview VISA or Serial Read/Write VI. The device manufacturer provided a DLL and a set of VIs to call the DLL functions to open/close port, send/receive character etc. (I have contacted the manufacturer as well and waiting on their response).
- The point where the program stops is where I am waiting for a specific character to be received from the device. A call library function node (CLF) invokes a function to search for the character at the open port and then, if found, removes it from the port. Both these CLF nodes were in "UI Thread". I changed them to reentrant thread. Now the Front panel does not freeze up. All my other loops in the main vi are now running. The only loop which is hung up is the subvi Search for Character (I am attaching it). [I put a global Debug Counter to see how long it is waiting.]
- Before any read operation I am clearing the port.
Interestingly, this same program has been running for the past 8-10 weeks and I have never seen this problem. Sometimes it ran for 15 hours before I terminated it. This problem is very recent. I have scanned the PC for virus, spyware and tried out different COM ports as well.
I will appreciate further inputs.
Thanks
Dave
02-05-2008 09:01 PM
Hi Dave,
Thanks for the information. One suggestion that I think could be interesting to try is running the executable on a different computer. If it works fine on a different computer, then it might be something with the serial port or the serial link. However, if it does not work on a different computer, then it is most likely something with the code. Also, what operating system are you using and what version of LabVIEW?
Also, If you built the DLL in LabVIEW and you are showing the front panel of the DLL, then there are two strict requirements to make it work. The first is that the Call Library Function must be set so that the DLL call is Reentrant. This is set by changing the execution category (under the Browse button) from Run in UI Thread to Reentrant. I know you have done this part. The second is the calling VI (the VI from the LabVIEW development environment that is calling the LabVIEW built DLL) must not be running in the User Interface execution system. This can be checked by selecting File»VI Properties»Execution and making sure that the execution system is standard, instrument i/o, data acquisition, other 1, or other 2 (same as caller may run in the user interface system if the parent VI calling this VI is running in the user interface system).
One other thing to check is to make sure that all inputs on both sides of your Call Library Function Node are wired. If the left side is not wired then the DLL will write over unallocated memory. If the right side is not wired up, LabVIEW will assume that your DLL does not need or use that allocated memory and will use it for something else. Your DLL will then overwrite reserved LabVIEW memory space, causing LabVIEW to crash.
I hope this helps!
Carla