AdvancedHMI Software

General Category => Open Discussion => Topic started by: rp on September 22, 2019, 02:44:27 PM

Title: [MicroLogix] Read PLC Values
Post by: rp on September 22, 2019, 02:44:27 PM
Hi all,

I am using a MicroLogix 1100 by EthernetIP communication (so, i am using the EthernetIPforSLCMicroCom driver).

My application has 5 pages, and in each page I need read differents variables each 2 seconds. The maximum variables number is 100 INT.

So, what is the best choice to read this 100 INT? The DataSubscriber or use a Timer (Windows Component) and each 2 seconds read variables with PLC.Read() function ?

Another question, how I can detect that PLC is disconnected? I need a flag/bit/int that indicates the PLC Communication state.

Thank you,
Title: Re: [MicroLogix] Read PLC Values
Post by: Godra on September 22, 2019, 04:40:04 PM
Your best choice would probably be to set the driver's PollRateOverride to 2000ms and subscribe to your addresses with DataSubscriber2, similar to the picture in this post:

https://www.advancedhmi.com/forum/index.php?topic=2451.msg15109#msg15109

Title: Re: [MicroLogix] Read PLC Values
Post by: rp on September 23, 2019, 03:13:39 PM
Thank you.

About a flag that indicates the plc communication status, there is any function or bit?

Thanks
Title: Re: [MicroLogix] Read PLC Values
Post by: Godra on September 23, 2019, 04:58:14 PM
Try using one or all of the driver's events to see if they work for you:

Code: [Select]
    Private Sub EthernetIPforSLCMicroCom1_ComError(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles EthernetIPforSLCMicroCom1.ComError

    End Sub

    Private Sub EthernetIPforSLCMicroCom1_ConnectionClosed(sender As Object, e As EventArgs) Handles EthernetIPforSLCMicroCom1.ConnectionClosed

    End Sub

    Private Sub EthernetIPforSLCMicroCom1_ConnectionEstablished(sender As Object, e As EventArgs) Handles EthernetIPforSLCMicroCom1.ConnectionEstablished

    End Sub

or check this forum for discussions that might have something, like this one:

https://www.advancedhmi.com/forum/index.php?topic=1086.msg5804#msg5804