02-28-2018 08:05 AM
@kapella98 wrote:
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.
Could you be more specific about what you mean by "lose communication" and "reconnect"? Do you mean that it deasserts and then reasserts handshaking signals on the COM port, or that it just just stops responding for a while, or do you mean that the COM port actually disappears from your system's device manager and then reappears?
02-28-2018 11:48 AM - edited 02-28-2018 11:56 AM
Hello Arteitle,
@arteitle wrote:
just stops responding for a while, or do you mean that the COM port actually disappears from your system's device manager and then reappears?
that is actually what I am seeing, it stops responding and it also disapears from Device Manager, LabVIEW VISA VIs return errors. When, device start responding again, Device Manager starts showing the device but there is no way LabVIEW (even NI-MAX) can recover communication with the device. The only way is to restart LabVIEW program. Some times I even have to reboot the PC such that NI runtime engine can start from scratch with the device, or at least that is what it looks like.
thank you for your interest.
02-28-2018 12:20 PM
@Minions wrote:
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.
I'm very interested to hear the answer to Minions' question. Also, can you tell us the make and model of this device?
02-28-2018 03:30 PM
@Gregory wrote:
@Minions wrote:
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.
I'm very interested to hear the answer to Minions' question. Also, can you tell us the make and model of this device?
well, the loss of communication is apparently by the device due to the software it is programmed with. We are talking about a PIC18F14K50 that has USB capability. Unfortunately we don't have the actual code but only the hex file to load the PICs with. I doubt that it has to do anything with heating/warming up, but even if this was the case, why does Device Manager would recover communication and NI-MAX won't? What I'm looking for is not why it disconnects, but rather, is there a way to reset NI-MAX based on the fact that Windows (Device Manager) is able to recover comm without having to reboot anything.
thank you for your observations and comments.
02-28-2018 03:37 PM
When you lose the port (it throws a connection error), do you continue to try reading from the port or do you programmatically handle the error and close the connection then try to re-establish another before reading from the port?
03-01-2018 12:41 PM
@Minions wrote:
When you lose the port (it throws a connection error), do you continue to try reading from the port or do you programmatically handle the error and close the connection then try to re-establish another before reading from the port?
you are correct in that when losing the port I get a connection error. I programmatically handle the error but it looks to me like LabVIEW cannot close (with VISA CLOSE VI) the port because the resource (i.e. COM6) is no longer available. I hope I make sence with my explanaition.
03-01-2018 01:18 PM
Have you tried programmatically refreshing MAX?
http://www.ni.com/example/26422/en/
If MAX is in error state after COM error and unable to refresh, you might be able to abort the Windows process by a command line call.
03-01-2018 06:42 PM
@pallen wrote:
Have you tried programmatically refreshing MAX?
http://www.ni.com/example/26422/en/
If MAX is in error state after COM error and unable to refresh, you might be able to abort the Windows process by a command line call.
Wow Pallen, this sounds like what I am looking for. I am going to give it a try and report back in this forum for everyone else to know. Your link sounds like the answer. thank you
04-15-2020 03:50 PM
Where has the example gone?
04-15-2020 05:27 PM
The original page is still available on the Way Back Machine here: http://web.archive.org/web/20190422034608/http://www.ni.com/example/26422/en
The RefreshMax.llb utility was also posted to the forum by Sean C in post here: https://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Automating-Measurement-Automation-Explorer/m...