1
Open Discussion / Re: C# Subscribe
« on: June 20, 2023, 09:26:41 PM »As per replying to this older topic.Have you tried it using a DataSubscriber?
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");
}
}
}
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...
The actual issue in my real project appears to be multi-threading; which I'll solve in much lower priority for now.