AdvancedHMI Software
General Category => Open Discussion => Topic started by: phuz on October 12, 2015, 04:25:51 PM
-
Hello, I have been using this software for about a year and I am now trying to add some functionality, but I am noticing that there is a timeout period of about 5 seconds when trying to read/write to an offline PLC. Could someone be kind enough to point out where this resides within the code? I cannot find it for the life of me!
-
This is the case where I would advocate to have a property IsConnected to check for PLC connected before writing tag. I use ConnectionEstablished event instead.
'Events
Private Sub EthernetIPforCLXCom1_ConnectionClosed(sender As Object, e As EventArgs) Handles PLC.ConnectionClosed
PLCIsConnected = False
End Sub
Private Sub EthernetIPforCLXCom1_ConnectionEstablished(sender As Object, e As EventArgs) Handles PLC.ConnectionEstablished
PLCIsConnected = True
End Sub
-
Most of the HMI's I've built lately , I've added a button to connect/disconnect on each screen , each screen has a timer counting from the plc so I know I have communications. Seems to give me a lot less grief on busy networks . How would I implement this so that when the connect button is clicked or when comms is established , a message pops up to say comms established and then disappears , if comms are lost another message would automatically pop up saying so.
Darrell
-
Hi Darrel
Could you share an example to know how you get this done?
-
I used 2 buttons and a textbox , would have preferred to use only one button and have the text change as to what state its in , but don't how,
but this works fine for me.
Code for connect button to enable subscriptions
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button6.Click
EthernetIPforPLCSLCMicroCom1.DisableSubscriptions = "False"
TextBox1.Text = EthernetIPforPLCSLCMicroCom1.IPAddress
End Sub
Code for connect button to disable subscriptions
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button7.Click
EthernetIPforPLCSLCMicroCom1.DisableSubscriptions = "True"
TextBox1.Text = EthernetIPforPLCSLCMicroCom1.IPAddress
End Sub
-
Thanks! I'll give it a try next time I have a chance.
-
Darrell,
If you're looking to just use one button as a toggle, there are a couple of ways to do it.
You could do something like this:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button6.Click
'Toggle the subscriptions
EthernetIPforPLCSLCMicroCom1.DisableSubscriptions = Not EthernetIPforPLCSLCMicroCom1.DisableSubscriptions
TextBox1.Text = EthernetIPforPLCSLCMicroCom1.IPAddress
'Change the button Text
If EthernetIPforPLCSLCMicroCom1.DisableSubscriptions = "True" Then
Button6.Text = "Disable"
Else
Button6.Text = "Enable"
End If
End Sub
You could put all of it inside the if statement.
Rich