Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MikeE

Pages: [1]
1
Open Discussion / Re: C# Subscribe
« on: June 20, 2023, 09:26:41 PM »
As per replying to this older topic. 

I have the same issue with subscribing not working; the driver now seems to have changed since the above was posted.  The third parameter is now missing?

Below is the entirety of the solution with a Windows form.  The read tag via the  push button works fine, but the subscription is not working.
The AdvancedHMI provided demo program works; but even the below very simple case is not tripping the event.
I tried a standard (non-UDT tag) and that made no difference.

Code: [Select]

using ClxDriver.Common;

namespace PLCTestB
{
    public partial class Form1 : Form
    {
        ClxDriver.EthernetIPforCLX plc;
        //  HearTBeat
        //IPC.ComsCycleOut
        public Form1()
        {
            InitializeComponent();
            plc = new ClxDriver.EthernetIPforCLX();
            plc.IPAddress = "192.168.1.31";
            plc.Subscribe("IPC.ComsCycleOut", 1, SubscribeCallBack);
        }

        private void SubscribeCallBack(object sender, PlcComEventArgs e)
        {
            label1.Text = e.Values[0];
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label2.Text = plc.Read("IPC.ComsCycleOut");

        }
    }
}

Have you tried it using a DataSubscriber?

DataSubscriber didn't work either; but I found the issue and bit of red-herring
Copying the example to recreate the issue, I didn't include the using ClxDriver...   :o

The actual issue in my real project appears to be multi-threading; which I'll solve in much lower priority for now.


2
Open Discussion / Re: C# Subscribe
« on: June 13, 2023, 09:24:20 PM »
As per replying to this older topic. 

I have the same issue with subscribing not working; the driver now seems to have changed since the above was posted.  The third parameter is now missing?

Below is the entirety of the solution with a Windows form.  The read tag via the  push button works fine, but the subscription is not working.
The AdvancedHMI provided demo program works; but even the below very simple case is not tripping the event.
I tried a standard (non-UDT tag) and that made no difference.

Code: [Select]

using ClxDriver.Common;

namespace PLCTestB
{
    public partial class Form1 : Form
    {
        ClxDriver.EthernetIPforCLX plc;
        //  HearTBeat
        //IPC.ComsCycleOut
        public Form1()
        {
            InitializeComponent();
            plc = new ClxDriver.EthernetIPforCLX();
            plc.IPAddress = "192.168.1.31";
            plc.Subscribe("IPC.ComsCycleOut", 1, SubscribeCallBack);
        }

        private void SubscribeCallBack(object sender, PlcComEventArgs e)
        {
            label1.Text = e.Values[0];
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label2.Text = plc.Read("IPC.ComsCycleOut");

        }
    }
}


Pages: [1]