AdvancedHMI Software

General Category => Support Questions => Topic started by: cmullis on October 29, 2015, 11:19:19 PM

Title: Subscription Datachanged event on Console
Post by: cmullis on October 29, 2015, 11:19:19 PM
I am trying to build a c# console app for interfacing with a CompactLogic PLC. I have the subscription setup and is retrieving tags from the controller. My problem is that I need to only fire the callback when data has changed. Now it is firing every time it polls. I would greatly appreciate the help.
Title: Re: Subscription Datachanged event on Console
Post by: Archie on October 29, 2015, 11:52:16 PM
You would have to use a DataSubscriber. It will filter the data returned from the driver and return it to a DataChanged event.
Title: Re: Subscription Datachanged event on Console
Post by: cmullis on October 30, 2015, 09:00:46 AM
Is there any sample code anywhere that you know of?
Title: Re: Subscription Datachanged event on Console
Post by: Archie on October 30, 2015, 09:14:00 AM
Here is a rough piece of code that may help get you started:

    Private ds As New AdvancedHMIControls.DataSubscriber

    Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        AddHandler ds.DataChanged, AddressOf DataChangedCallback
        ds.PLCAddressValue = "MyTag"
.
.
    End Sub