Home
Help
Search
Login
Register
AdvancedHMI Software
»
General Category
»
Support Questions
»
How to Manage modbusRTUCom connection
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to Manage modbusRTUCom connection (Read 1348 times)
mesutonus
Newbie
Posts: 13
How to Manage modbusRTUCom connection
«
on:
March 17, 2015, 04:30:16 PM »
Hello,
when calling read/write functions from ModbusRTUCom object it connects automatically. However i can not manage connection and close the port it opens.
Could you please help?
Logged
Archie
Administrator
Hero Member
Posts: 5322
Re: How to Manage modbusRTUCom connection
«
Reply #1 on:
March 17, 2015, 04:41:48 PM »
You could dispose the instance, but then it is no longer usable.
ModbusRTUCom1.Dispose
What would be a scenario where you would need to close the connection without exiting the application?
Logged
mesutonus
Newbie
Posts: 13
Re: How to Manage modbusRTUCom connection
«
Reply #2 on:
March 17, 2015, 04:44:14 PM »
I use System.IO.SerialPort object to write registers. And reading with advancedhmi.
So i need to keep only only object alive during process.
Logged
mesutonus
Newbie
Posts: 13
Re: How to Manage modbusRTUCom connection
«
Reply #3 on:
March 17, 2015, 04:47:10 PM »
After a short brainstorm it seemed impossible to manage. Because readings and writings are being made in short frequencies. So a reading request may interrupt an important write process.
Logged
Archie
Administrator
Hero Member
Posts: 5322
Re: How to Manage modbusRTUCom connection
«
Reply #4 on:
March 17, 2015, 04:48:53 PM »
You can add this subroutine to ModbusRTUCom.VB
Public Sub CloseConnection()
If DLL.ContainsKey(MyDLLInstance) AndAlso DLL(MyDLLInstance) IsNot Nothing Then
DLL(MyDLLInstance).CloseCom()
End If
End Sub
Logged
mesutonus
Newbie
Posts: 13
Re: How to Manage modbusRTUCom connection
«
Reply #5 on:
March 17, 2015, 04:49:44 PM »
great!
Logged
Print
Pages: [
1
]
« previous
next »
AdvancedHMI Software
»
General Category
»
Support Questions
»
How to Manage modbusRTUCom connection