Author Topic: DataSubscriber2 with clx driver  (Read 1980 times)

Joe Matkowski

  • Newbie
  • *
  • Posts: 47
    • View Profile
DataSubscriber2 with clx driver
« on: October 20, 2015, 04:06:15 PM »
I am using clx driver with ver3.99a and trying to read a real array[10] with datasubscriber2 but cannot seem to get the code correct to read anything past element


  Private Sub DataSubscriber21_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
        blSilo1.Value = e.Values(0)
        BarLevel1.Value = e.Values(0, 1)

    End Sub

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: DataSubscriber2 with clx driver
« Reply #1 on: October 20, 2015, 05:01:15 PM »
 Private Sub DataSubscriber21_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles DataSubscriber21.DataChanged
        blSilo1.Value = e.Values(0)
        BarLevel1.Value = e.Values(1)

    End Sub

Joe Matkowski

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: DataSubscriber2 with clx driver
« Reply #2 on: October 20, 2015, 05:43:48 PM »
So I should just add each element of the array as a member in the collection?
I assigned member 0 "myarray" 10 elements. So I was expecting to be able to pull the entire array something like member 0 element 1,2,3
Thanks for your help

Jody

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: DataSubscriber2 with clx driver
« Reply #3 on: October 20, 2015, 05:52:48 PM »
If you add the starting element and the number of elements, then the DataReturned event will fire and return an array of e.values.

If you use the DataChanged event handler, it may only fire if the first element changes value.

So let's say you subscribe to MyArray[0] with 10 elements. The DataReturned event will fire at the PollRateOverride interval and return 10 values, e.values(0) through e.values(9)

Joe Matkowski

  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: DataSubscriber2 with clx driver
« Reply #4 on: October 20, 2015, 07:10:26 PM »
Got it thanks Archie. Thats what I was looking for.