Author Topic: ConnectionEstablished does not work with EthernetIPforCLXCom1?  (Read 1524 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
In my form load, I have the followings:
Code: [Select]
         InitializeCombo()
        'Dim dt As Date = PLC.ReadClock
        Application.DoEvents()
        System.Threading.Thread.Sleep(200)

        If PLCIsConnected Then
            PLC.Write("FromPC_Reset", 1)      'From PC Reset
            Sleep(250)
            PLC.Write("FromPC_Reset", 0)
        Else
            MessageBox.Show("PLC IS DISCONNECTED", "PLC WARNING", MessageBoxButtons.OK, MessageBoxIcon.Hand)
        End If

This same code works with  EthernetIPforSLCMicroCom1, but not with EthernetIPforCLXCom1.  I even tried a ReadClock, my variable got the clock time, and yet it always display PLC is disconnected msg.
Code: [Select]
Private Sub PLC_ConnectionEstablished(sender As Object, e As EventArgs) Handles PLC.ConnectionEstablished
        PLCIsConnected = True

    End Sub
TIA
« Last Edit: April 12, 2018, 09:17:36 AM by bachphi »
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ConnectionEstablished does not work with EthernetIPforCLXCom1?
« Reply #1 on: April 12, 2018, 09:32:59 AM »
Strange , but it is working now with both method of AddHandler  event and double click ConnectionEstablished event
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Re: ConnectionEstablished does not work with EthernetIPforCLXCom1?
« Reply #2 on: April 12, 2018, 12:24:27 PM »
It appears that ConnectionEstablished event will fire after a 'write'.  I remove the InitializeCombo which has the a 'write', then the disc. msg come back.
or read some dumb tag will do as well.

This is counter intuitive, unlike drivers like Ingear, it has  its own a IsConnected property.

Interesting, they also support Compact Framework and linux with mono framework as well
« Last Edit: April 12, 2018, 01:19:55 PM by bachphi »
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: ConnectionEstablished does not work with EthernetIPforCLXCom1?
« Reply #3 on: April 19, 2018, 10:44:06 PM »
The ConnectionEstablished fires after the first communication packet is sent. The AdvancedHMI drivers are unique in that it automatically performs the connection after the first read or write. This saves you from having to monitor for disconnection from timeout and having to add the code to open every time.

Way back the AdvancedHMI drivers used to work in the compact framework, but I decided it was no longer worth the effort to maintain since the CF has all but been declared dead by Microsoft. The drivers do work under Mono, which is how they run on the Pi. This now includes the serial drivers in the latest Beta release of 3.99y.
« Last Edit: April 19, 2018, 10:47:37 PM by Archie »