LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW loses communication to COM ports


@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?

0 Kudos
Message 11 of 20
(1,403 Views)

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.

0 Kudos
Message 12 of 20
(1,393 Views)

@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?

0 Kudos
Message 13 of 20
(1,380 Views)

@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.

0 Kudos
Message 14 of 20
(1,358 Views)

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?

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 15 of 20
(1,353 Views)

@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.

0 Kudos
Message 16 of 20
(1,317 Views)

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.  

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 17 of 20
(1,313 Views)

@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

0 Kudos
Message 18 of 20
(1,303 Views)

Where has the example gone?

0 Kudos
Message 19 of 20
(1,098 Views)

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...

 

 

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 20 of 20
(1,089 Views)