Hello,
I have a class called "Signal" setup as follows.
Public Class Signal 'class with properties of signal. Links ModbusTCP/IP driver to memory bit adresses for power and color
Dim _Connection As AdvancedHMIDrivers.ModbusTCPCom
Dim _PWRaddress As String 'memory bit address of power control relay
Dim _CLRaddress As String 'memory bit address of color control relay
Public Property Connection() As AdvancedHMIDrivers.ModbusTCPCom
Get
Return _Connection
End Get
Set(value As AdvancedHMIDrivers.ModbusTCPCom)
_Connection = value
End Set
End Property
Public Property PWRaddress As String
Get
Return _PWRaddress
End Get
Set(value As String)
_PWRaddress = value
End Set
End Property
Public Property CLRaddress As String
Get
Return _CLRaddress
End Get
Set(value As String)
_CLRaddress = value
End Set
End Property
Public Sub WriteCLR(ByVal WriteValue As Integer)
_Connection.Write(_CLRaddress, WriteValue) 'writes to signals color address
End Sub
Public Sub WritePWR(ByVal WriteValue As Integer)
_Connection.Write(PWRaddress, WriteValue) 'writes to signals power address
End Sub
End Class
I have initialized 40 "signals" on load in the main form as "signal1", "signal2", etc. I then added these signals to various object arrays which groups them together and allows me to write to that group using a single button click by looping through all of the signals in that groups array. This works fine except when connection is lost to one of the ModbusTCP drivers. If I disconnect one of the PLCs, the program seems to freeze as it trys to connect to the PLC for every signal in the array.
I am wondering if there is a way to access the status of the Modbus connection and move on the the next object in the array if it is not active or not able to ping that PLC. Any help would be greatly appreciated.
Thanks,
Andrew