Author Topic: Timeouts for WRITE connections  (Read 2064 times)

phuz

  • Newbie
  • *
  • Posts: 7
    • View Profile
Timeouts for WRITE connections
« 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!

bachphi

  • Hero Member
  • *****
  • Posts: 642
    • View Profile
Re: Timeouts for WRITE connections
« Reply #1 on: October 13, 2015, 08:36:07 AM »
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.

Code: [Select]

    '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
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
Re: Timeouts for WRITE connections
« Reply #2 on: October 18, 2015, 10:20:29 AM »
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

Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Timeouts for WRITE connections
« Reply #3 on: October 28, 2015, 11:20:44 AM »
Hi Darrel

Could you share an example to know how you get this done?

Darrell

  • Full Member
  • ***
  • Posts: 198
  • Electrician / PLC Technician
    • View Profile
Re: Timeouts for WRITE connections
« Reply #4 on: October 29, 2015, 12:30:03 PM »
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



Noe

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Timeouts for WRITE connections
« Reply #5 on: October 29, 2015, 03:13:11 PM »
Thanks! I'll give it a try next time I have a chance.

rbelknap

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Timeouts for WRITE connections
« Reply #6 on: November 05, 2015, 12:53:43 PM »
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:
Code: [Select]
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