Sorry, didn't finish writing question before it posted.
Hi,
I'm using version 3.5.9. If I add several Data Subscribers using code that looks something like:
For i = 1 To 8
mobjDataSubscribers(DataSubscriberCount) = New MfgControl.AdvancedHMI.DataSubscriber
mobjDataSubscribers(DataSubscriberCount).CommComponent = EthernetIPforCLXCom1
mobjDataSubscribers(DataSubscriberCount).SynchronizingObject = Me
mobjDataSubscribers(DataSubscriberCount).PLCAddressValue = "AndOn_Call_Sta." & i.ToString '(i + 1).ToString("D2")
AddHandler mobjDataSubscribers(DataSubscriberCount).DataChanged, AddressOf DataSubscriber_DataChanged
DataSubscriberCount += 1
Next
The DataSubscriber_DataChanged event seems to fire twice for each change when a button is pressed. I'm logging info to a file and doing Debug.Print and the data looks like:
PLCAddress: AndOn_Line_Stop_Sta.6 - True 11/05/2013 10:05:03 AM
PLCAddress: AndOn_Line_Stop_Sta.6 - True 11/05/2013 10:05:03 AM
PLCAddress: CONV_T2.S_RUN - False 11/05/2013 10:05:04 AM
PLCAddress: CONV_T2.S_RUN - False 11/05/2013 10:05:05 AM
PLCAddress: AndOn_Call_Sta.6 - True 11/05/2013 10:05:06 AM
PLCAddress: AndOn_Call_Sta.6 - True 11/05/2013 10:05:06 AM
PLCAddress: AndOn_Line_Stop_Sta.6 - False 11/05/2013 10:05:08 AM
PLCAddress: AndOn_Line_Stop_Sta.6 - False 11/05/2013 10:05:08 AM
PLCAddress: AndOn_Call_Sta.6 - False 11/05/2013 10:05:10 AM
PLCAddress: AndOn_Call_Sta.6 - False 11/05/2013 10:05:10 AM
PLCAddress: CONV_T2.S_RUN - True 11/05/2013 10:05:16 AM
PLCAddress: CONV_T2.S_RUN - True 11/05/2013 10:05:17 AM
When I walk through the code, it looks like the DataSubscriber_DataChanged gets fired twice for each change.
I'm I doing something wrong on my side?
I'm watching 3 sets of data (3 x 12) and using the same DataSubscriber_DataChanged event for all of them and just distinguishing the different sets by looking at the e.PlcAddress property. Should I be using different DataSubscriber_DataChanged events for each set?
Also, when subscribing to data, what are the pros/cons for using MfgControl.AdvancedHMI.DataSubscriber like above versus doing something like:
SubscriptionID = EthernetIPforCLXCom1.Subscribe("Program:MainProgram.E_Stop_PB[1])", 1, 14, AddressOf SubscribedDataReturned)
Is it just having to keep track of SubscriptionID's and doing "EthernetIPforCLXCom1.UnSubscribe(SubscriptionID)" in the Form Closing event?
Thanks,
Chris