From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview hangs up when accessing RSLinx OPC server if cable is disconnected

I am using Datascoket to connect to RSLinx - OPC server connecting AB

PLCs. It works great. When I am working offline all the datasocket vi

that are trying to communicate to RSLinx OPC server make my Labview

application hang up for approximately 3 minutes. After 3 minutes I do

get an error message and my application handles it properly. It just

doesn't look right for the application to hangup. Do I have an option

to fix this. I chosen a differnt thread (other 2 and standard) for the

subVI fetching values from RSLinx but it doesn't seem to help. The

screen still gets locked up and it doesn't update for at least 2 to 3

minutes. I understand in normal circumstances
I'll not have this

scenario but in the case when I just feel that there should be a

gracefull way to handle a situation like this.

Thanks
0 Kudos
Message 1 of 3
(2,926 Views)
Hi K seeker,

Your best bet would be to check your connection whenever possible for a break. To do this, take your datasocket refnum, and wire it to a property node. You will have the connection status property, which is an cluster. You can then unbundle that cluster and check the Datasocket status, which is an enum. From here, you have the ability to identify when the connection has gone bad. The only drawback is that if you are inside of a Read or Write, then you cannot check it until after that is done. In this case, you would have a timeout set for the read and/or write, with the status checker before you do it. This way, if the connection is bad, you can catch it before you get into a read/write.

Jeremy L.
National Instruments
Jeremy L.
National Instruments
Message 2 of 3
(2,926 Views)

Checking the properties does not work because LV is just talking to RSlinx therefore there are no error codes.  The real problem is that RSlinx hijacks the DS timeout until the requested write is complete.  If the physical connection from RSlinx to the PLC (eg: Serial) is severed, it can hard lock LV while RSlinx attempts to communicate.

0 Kudos
Message 3 of 3
(1,427 Views)