Author Topic: DataSubscriber to read multiple tags  (Read 3085 times)

KanHaz

  • Newbie
  • *
  • Posts: 19
    • View Profile
DataSubscriber to read multiple tags
« on: January 12, 2015, 09:36:38 AM »
Hi,

    I would like to read multiple tags with one DataSubscriber. Is there a tutorial or an example someone could post/direct me to? I've searched the forum and I've found bits and pieces but a full on example or explaination. If anyone could help I would greatly appreciate it.

Thanks in advance.

*Modified because I posted it before I could write anything.
« Last Edit: January 12, 2015, 09:41:45 AM by KanHaz »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5306
    • View Profile
    • AdvancedHMI
Re: DataSubscriber to read multiple tags
« Reply #1 on: January 12, 2015, 09:46:08 AM »
The DataSubscriber is only designed to handle a single tag. You could use it to subscribe to a "trigger" tag that would tell when to read the other tags.

For example, set the DataSubscriber to monitor a bit. When that bit changes, the DataChanged event will fire. Within that event, you could read the rest of the tags.

If you need all of the tags to update independently, you will need a separate DataSubscriber for each tag.

If all of your tags are in an array, you could create a subscription within code to read all of the array elements at once.

KanHaz

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: DataSubscriber to read multiple tags
« Reply #2 on: June 15, 2015, 11:31:29 AM »
I know this topic is old but are there any examples of how to do either of these methods?

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5306
    • View Profile
    • AdvancedHMI
Re: DataSubscriber to read multiple tags
« Reply #3 on: June 15, 2015, 01:15:48 PM »
The latest version now handles multiple subscriptions with a single DataSubscriber. Simply separate the addresses with a comma. When the data comes back use e.PLCAddress to determine which value came back.

There is also a DataSubscriber2 that makes this a little more intuitive with PLCAddressValueItems

KanHaz

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: DataSubscriber to read multiple tags
« Reply #4 on: June 15, 2015, 01:26:45 PM »
Good to know. I saw the DataSubscriber2 in the toolbox when I upgraded my version for Linux but didn't play around with it. Knowing how to use a single subscriber is now the focus of my Linux project because I get 3+ subscribers in one project and the form takes a while to load and updates about every 10-15 seconds. I have a clock on my page and it freezes for that long. Still haven't tried pulling information from a PLC yet, just trying to work out the bugs of why the form wouldn't load.