LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW loses communication to COM ports

Hello, I have an external device that connects to my PC via COM port and in turns it communicates with my labview program using NI-VISA. The external device has a small known glitch that causes to lose communication with the PC but after less then a second it automatically reconnects. I have seen Device Manager recognizing the device when it reconnects but NI-MAX will not recognize it until I close it and open it up again. I looks to me as if NI-VISA would have to be reset it. Is there a way to include a routine to have my labview code reset NI-VISA drivers, probably? I have tried closing the port and open it up again but still doesn't work for me apparently because the COM port is no longer available, so it cannot close a session that does not exists.

 

any ideas what I could try next? 

0 Kudos
Message 1 of 20
(4,299 Views)

I understand the issue as you've described it. Unfortunately, my experience is that you have to close LabVIEW or MAX, whichever you are using, and re-open them to get them to recognize a serial port that has been recognized by the system after LabVIEW or MAX was started. E.g. I got nothin. Sorry. I hope someone can post a fix, but I've always assumed there was none.

-------------------------------------------------------------
David Thomson Original Code Consulting
www.originalcode.com
National Instruments Alliance Program Member
Certified LabVIEW Architect
Certified Embedded Systems Developer
-------------------------------------------------------------
There are 10 kinds of people: those who understand binary, and those who don't.
0 Kudos
Message 2 of 20
(4,295 Views)

that is correct Dave_Thomson. Up until now, I have not found anything other than closing LabVIEW or MAX and open it again. thanks for answering though.

0 Kudos
Message 4 of 20
(4,222 Views)

I have to comment here that this is not really a LabVIEW issue.  Any application that is using a COM port and did not exit gracefully will exhibit the same issue.  At least with LabVIEW, we can shut down the runtime engine and MAX and be able to recover.

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 5 of 20
(4,218 Views)

Are you trying Refresh (F5) in MAX to scan for devices?

0 Kudos
Message 6 of 20
(4,217 Views)

Thank you Pallen. I check the links but, if I understood them correctly, they all three talk about scanning, automatic detect and VISA configure having a base line the fact that MAX recognizes the ports. My problem is MAX loses communication and does not recognizes the device until closing and opening MAX. What is weird is that Windows loses communication at the same time MAX does, but when my external device becomes available, Windows recognizes it (based on Device Manager) but MAX doesn't. From then on, scanning, automatic detect and port configuration are no longer a solution.

 

thanks

0 Kudos
Message 7 of 20
(4,217 Views)

Correct Billko, that is exactly my problem, I agree with you. So my question is if there is something that can programmatically restart the runtime engine and/or MAX. I guess I forgot to mention this communication issues are happening while running the labview program in a production environment. It is not practical for me to be shutting down the runtime engine and/or MAX. That is why I'm trying for a programmatical solution, if there is any.

0 Kudos
Message 8 of 20
(4,213 Views)

thank you Gregoryj, I guess I forgot to mention this communication issues are happening while running the labview program in a production environment. It is not practical for me to be shutting down the runtime engine and/or MAX. That is why I'm trying for a programmatical solution, if there is any.

0 Kudos
Message 9 of 20
(4,211 Views)

Is the loss of communication by the device more of a heating/warm-up issue or a length of connection issue.  If it is the latter, then setup your LabVIEW program as connect to device, command/query, close connection each loop through your program.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
Message 10 of 20
(4,200 Views)