Author Topic: Using Datasubscriber  (Read 1972 times)

andreaboschetti71

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Using Datasubscriber
« 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

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Using Datasubscriber
« Reply #1 on: September 16, 2017, 12:23:28 PM »
Try calling BeginInit() on the DataSubscriber before setting the properties, then EndInit() after.

andreaboschetti71

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Using Datasubscriber
« Reply #2 on: September 17, 2017, 09:36:17 AM »
If you see my code i'm already using begininit and endinit

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Using Datasubscriber
« Reply #3 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?

andreaboschetti71

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Using Datasubscriber
« Reply #4 on: September 17, 2017, 10:00:34 AM »
I send you an image

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5260
    • View Profile
    • AdvancedHMI
Re: Using Datasubscriber
« Reply #5 on: September 17, 2017, 10:55:27 AM »
Try it this way:

arraydatasubscriber(i - 1).PLCAddressValue = New MfgControl.AdvancedHMI.Drivers.PLCAddressItem("B39:0/0")

DougLyons

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Using Datasubscriber
« Reply #6 on: September 17, 2017, 11:03:29 AM »
You might want to try using the alternate syntax by using "B39/0".

andreaboschetti71

  • Jr. Member
  • **
  • Posts: 61
    • View Profile
Re: Using Datasubscriber
« Reply #7 on: September 17, 2017, 11:09:00 AM »
Thank you Archie, now it's working fine