Author Topic: Subscription Datachanged event on Console  (Read 848 times)

cmullis

  • Newbie
  • *
  • Posts: 3
    • View Profile
Subscription Datachanged event on Console
« 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.

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Subscription Datachanged event on Console
« Reply #1 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.

cmullis

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Subscription Datachanged event on Console
« Reply #2 on: October 30, 2015, 09:00:46 AM »
Is there any sample code anywhere that you know of?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5269
    • View Profile
    • AdvancedHMI
Re: Subscription Datachanged event on Console
« Reply #3 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