Author Topic: Unable to set polling interval of PLC through c# application  (Read 4068 times)

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Unable to set polling interval of PLC through c# application
« Reply #15 on: January 20, 2017, 04:20:40 AM »
Code: [Select]
       private int SubscriptionID1;
        private void Button2_Click_1(object sender, EventArgs e)
        {
            SubscriptionID1 = ethernetIPforCLXCom1.Subscribe("MyTag", 1, 500, Subscription_DataReceived);
        }

        private void Subscription_DataReceived(object sender,MfgControl .AdvancedHMI . Drivers.Common.PlcComEventArgs e)
        {
            Label1.Text = e.Values[0];
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ethernetIPforCLXCom1.UnSubscribe(SubscriptionID1);
        }

thug_

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Unable to set polling interval of PLC through c# application
« Reply #16 on: January 20, 2017, 05:11:12 AM »
Code: [Select]
       private int SubscriptionID1;
        private void Button2_Click_1(object sender, EventArgs e)
        {
            SubscriptionID1 = ethernetIPforCLXCom1.Subscribe("MyTag", 1, 500, Subscription_DataReceived);
        }

        private void Subscription_DataReceived(object sender,MfgControl .AdvancedHMI . Drivers.Common.PlcComEventArgs e)
        {
            Label1.Text = e.Values[0];
        }

        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            ethernetIPforCLXCom1.UnSubscribe(SubscriptionID1);
        }
Thanks Archie, it is working, I will need to updated a lot of code now, but at least there is a way to control polling time.

Just quick question about this number of elements, I am right now setting it to 1, that means I suppose it will read one element from plc and that is in this case N7:4 or whatever tag I provide. In the case this number of elements is higher let's say 10, is that mean that it will read elements from N7:0 until and including N7:9 ?

Cheers
« Last Edit: January 20, 2017, 05:14:42 AM by thug_ »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: Unable to set polling interval of PLC through c# application
« Reply #17 on: January 20, 2017, 08:39:59 AM »
Just quick question about this number of elements, I am right now setting it to 1, that means I suppose it will read one element from plc and that is in this case N7:4 or whatever tag I provide. In the case this number of elements is higher let's say 10, is that mean that it will read elements from N7:0 until and including N7:9 ?
Just off the top of my head, I do not know if that particular driver supports that. Some of the drivers do support it, but I cannot remember if that one does. In the original design, it wasn't needed because subscriptions were only used by the built in controls which only used one element. Later on as more complex controls were added, this was implemented in the most popular drivers.