AdvancedHMI Software

General Category => Support Questions => Topic started by: andreaboschetti71 on September 16, 2017, 12:14:58 PM

Title: Using Datasubscriber
Post by: andreaboschetti71 on September 16, 2017, 12:14:58 PM
Hello, I have an application that use datasubscriber object and in the past, connected with DF1Comm driver to a Micrologix1500 worked fine. Now I changed the PLC with a new Micrologix1400 with Ethernet port so I must use EthernetIPforSLCMicroCom driver but I'm not able to make datasubscriber working. I have an exception when I assign new tag address. For best understand I show you the instruction:

Old working

arraydatasubscriber(i - 1) = New MfgControl.AdvancedHMI.DataSubscriber(Me.components)
                CType(arraydatasubscriber(i - 1), System.ComponentModel.ISupportInitialize).BeginInit()
                arraydatasubscriber(i - 1).CommComponent = Me.DF1Comm1
                arraydatasubscriber(i - 1).PLCAddressValue = "B39:0/0"
                arraydatasubscriber(i - 1).SynchronizingObject = Me
                arraydatasubscriber(i - 1).PollRate = 0
                arraydatasubscriber(i - 1).Value = Nothing
                CType(arraydatasubscriber(i - 1), System.ComponentModel.ISupportInitialize).EndInit()

New with exception in red row

arraydatasubscriber(i - 1) = New DataSubscriber(Me.components)
                CType(arraydatasubscriber(i - 1), System.ComponentModel.ISupportInitialize).BeginInit()
                arraydatasubscriber(i - 1).ComComponent = Me.EthernetIPforSLCMicroCom1
                arraydatasubscriber(i - 1).PLCAddressValue.PLCAddress = "B39:0/0"
                'arraydatasubscriber(i - 1).SynchronizingObject = Me
                'arraydatasubscriber(i - 1).PollRate = 0
                'arraydatasubscriber(i - 1).Value = Nothing
                CType(arraydatasubscriber(i - 1), System.ComponentModel.ISupportInitialize).EndInit()

Can someone help me?
thank you in advance
Title: Re: Using Datasubscriber
Post by: Archie on September 16, 2017, 12:23:28 PM
Try calling BeginInit() on the DataSubscriber before setting the properties, then EndInit() after.
Title: Re: Using Datasubscriber
Post by: andreaboschetti71 on September 17, 2017, 09:36:17 AM
If you see my code i'm already using begininit and endinit
Title: Re: Using Datasubscriber
Post by: Archie on September 17, 2017, 09:47:00 AM
If you see my code i'm already using begininit and endinit
I apologize, I completely overlooked that. What exception are you getting? Does it give you the option of showing the details to get to the line number in the code?
Title: Re: Using Datasubscriber
Post by: andreaboschetti71 on September 17, 2017, 10:00:34 AM
I send you an image
Title: Re: Using Datasubscriber
Post by: Archie on September 17, 2017, 10:55:27 AM
Try it this way:

arraydatasubscriber(i - 1).PLCAddressValue = New MfgControl.AdvancedHMI.Drivers.PLCAddressItem("B39:0/0")
Title: Using Datasubscriber
Post by: DougLyons on September 17, 2017, 11:03:29 AM
You might want to try using the alternate syntax by using "B39/0".
Title: Re: Using Datasubscriber
Post by: andreaboschetti71 on September 17, 2017, 11:09:00 AM
Thank you Archie, now it's working fine