07-06-2012 08:47 AM
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?
Solved! Go to Solution.
07-06-2012 08:54 AM
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
07-06-2012 09:53 AM
Thanks Norbert_B
Never really thought about just writing to the serial port. Duh.
01-18-2013 07:49 AM
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.
01-18-2013 08:34 AM
Attached my test program... for locking without succes![]()
I can run both vi's without getting an error on the same COM-port...
Any advice?
01-18-2013 09:05 AM
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
01-18-2013 02:50 PM
At Visa Open.vi, there is a 'duplicate session' input flag, when this is set to TRUE. It works fine!