LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sometimes no data on serial port

I need to control a device using the 2 standard serial ports of my PC. I am using LV 6.0 and as OS Win2000.
COM 1 is used to move an arm over a table (VISA not used). This is a message driven communication.
COM 2 is used to read out a laser distance meter (use VISA). This device gives continuously data.
Using both COM ports separately works fine. At least I didn't noticed a problem when using VISA.
However when I use both COM ports together the second COM port sometimes don’t get data.
COM 1 is always open. COM 2 I open just before I want to measure data and close it afterwards. And sometimes, after opening COM 2, the number of bytes available stays 0, although the measuring device continuously gives data.
Although VISA works
better, I still have problems when using both COM ports together.
Does anyone have analogous experiences and what is the best way to solve this problem?
Can both COM ports influence each other? Is using a separate board with serial ports a solution?
Can I clear the serial buffer of a COM port with VISA, or must I just read the data and through them away?
0 Kudos
Message 1 of 6
(3,289 Views)
I'm not exactly sure what is wrong, but I would tend to think that there might be a conflict between using the old serial drivers and the VISA drivers at the same time. I've run into problems across different LabVIEW applications where one would use the legacy driver and the other use VISA. After running the VI with the legacy driver and properly closing the COM port, I would no longer have access to the COM port through VISA in the other application (i.e. it would throw an error).

The best solution, if you have the time to accomplish it, would be to use VISA for communication through both COM ports. I'm not too clear on what you could use as a short-term fix. Are you getting any error messages out of the serial VIs for COM 2? Is it having problems initializing the
port?

Pete
0 Kudos
Message 2 of 6
(3,289 Views)
I have never heard of a situation where two COM ports influenced each other, but anything is possible, I guess. Does the data expected at COM2 actually show up at COM1? It seems odd that it would appear nowhere. Does the Laser Distance Meter give any indications that there could be an error when it receives data or sends it out? Also, I don't know of a why to clear a COM port using VISA. As far as I can tell, there doesn't seem a way to do that.
J.R. Allen
0 Kudos
Message 3 of 6
(3,289 Views)
COM 1 works normal.
There are sometimes no data available on COM 2. The NumberOfBytes in the buffer stays 0, although the Laser Distance Meter continuously gives data, without error indication.
0 Kudos
Message 4 of 6
(3,289 Views)
Thanks.
I will try to use the VISA driver for both COM ports.
There is no error. The initialization succeeds, but the number of bytes in the buffer of COM 2 stays 0. And the read returns with a timeout.

Marc
0 Kudos
Message 5 of 6
(3,288 Views)

I came across this very old thread and just wanted to know what Laser Distance Meter you are using.  I can't seem to find one that has a hard-wired (non-Bluetooth) control port.

 

Thanks.

 

Denis

0 Kudos
Message 6 of 6
(2,919 Views)