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: 

Automatic reconnection of MODBUS TCP

Solved!
Go to solution

Hi there! 

I have a plc which communicates using Modbus TCP IP with my Lab view code. 

I want to develop my code such that the reconnection happens automatically whenever I remove my ethernet cable and connect again. 

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

Hi,

 

I was suggesting putting a VISA close function and wire your module ports reference to it before closing the ModBUS communication.

Visa.png

0 Kudos
Message 2 of 3
(1,626 Views)
Solution
Accepted by topic author doc_d

Continuously check for error. If there is no error then pass the modbus reference. If there is any error disconnect the reference and create new reference as below image.

modbus.PNG


CLD Using LabVIEW since 2013
Message 3 of 3
(1,614 Views)