3
« on: November 14, 2022, 08:37:32 AM »
Having a hard time with the BeginReadMultiple method when using on back end only, not coupled with winforms. I think I'm misunderstanding the use of BeginReadMultiple.
using ClxDriver.Common;
using cPLCAppCom;
namespace PLCTest
{
class PLCinit
{
public EthernetIPforCLXCom plcCom = new EthernetIPforCLXCom();
public void Config()
{
System.Diagnostics.Debug.WriteLine("Hello Config");
plcCom.CIPConnectionSize = 508;
plcCom.DisableMultiServiceRequest = false;
plcCom.DisableSubscriptions = false;
plcCom.IniFileName = "";
plcCom.IniFileSection = null;
plcCom.IPAddress = "x.x.x.x";
plcCom.PollRateOverride = 500;
plcCom.Port = 44818;
plcCom.ProcessorSlot = 0;
plcCom.RoutePath = null;
plcCom.Timeout = 4000;
plcCom.UseOmronRead = false;
plcCom.DataReceived += new System.EventHandler<PlcComEventArgs>(TagDataReceived);
string[] tags = new string[2];
tags[0] = "test1";
tags[1] = "test2";
plcCom.BeginReadMultiple(tags);
}
private void TagDataReceived(object? sender, PlcComEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Hello Data");
string read_tags = e.Values[0];
System.Diagnostics.Debug.WriteLine(read_tags);
}
}
}