02-22-2018 10:30 AM
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?
02-22-2018 10:34 AM
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.
02-22-2018 10:36 AM
Found a few good threads right on this forum.
https://forums.ni.com/t5/LabVIEW/Scanning-for-COM-ports/td-p/275550
https://forums.ni.com/t5/LabVIEW/Automatically-detect-com-port/td-p/1334462
02-27-2018 11:09 AM
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.
02-27-2018 11:15 AM
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.
02-27-2018 11:17 AM
Are you trying Refresh (F5) in MAX to scan for devices?
02-27-2018 11:17 AM
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
02-27-2018 11:26 AM
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.
02-27-2018 11:27 AM
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.
02-27-2018 02:09 PM
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.