LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port in use conflict

Solved!
Go to solution

I am using LabView 11 Pro

 

I am controlling an instrument that is not always connected. Not a problem. However there is another program that is used using the same comm port on the same instrument. Is there a way of detecting weather the comm port is in use without interrogating the instrument?

0 Kudos
Message 1 of 7
(4,550 Views)
Solution
Accepted by JackTK

Trying to open the communication to the serial port using NI VISA should not affect an already existing communication from another application. You will get an error stating something like "device already in use".

 

So all in all:

Simply try to open the connection to the serial port and check for the error. If it occurs, the resource is already blocked (in use). If not, your application can use it.

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 7
(4,546 Views)

Thanks Norbert_B

 

Never really thought about just writing to the serial port. Duh.

0 Kudos
Message 3 of 7
(4,535 Views)

I have one program polling a serial port, when trying to open this Visa resource with another program. I get no Error.

Even tried opening with "Exclusive lock"  (Among "Visa default" & "Load Config Settings)

 

The result is that my LV polling program stops polling without any error...

 

Does this "Visa Open" serial port actually give "device already in use" ?    not in my case...

 

Note: I am working with 'USB Serial ports" and wanted to check before opening if it's already in use... but don't know how yet.

0 Kudos
Message 4 of 7
(4,475 Views)

Attached my test program... for locking without succesRobot Frustrated

 

I can run both vi's without getting an error on the same COM-port...

 

Any advice?

Download All
0 Kudos
Message 5 of 7
(4,462 Views)

The lock is per OS process. Since you call your VIs most probable within the same LabVIEW.exe process, the lock will not take affect.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 7
(4,451 Views)

At Visa Open.vi, there is a 'duplicate session' input flag, when this is set to TRUE. It works fine!

 

0 Kudos
Message 7 of 7
(4,433 Views)