change - HSL 读取Plc测试

master
wenjy 1 year ago
parent 30661be234
commit 3b544355fc

@ -119,7 +119,7 @@ namespace MCRun
};
WorkbenchSingleton.InitializeWorkbench();
PlcBusiness.Instance.InitPlcConnect(PlcType.SiemensPlc, "127.0.0.1", 9600);
PlcBusiness.Instance.InitPlcConnect(PlcType.SiemensPlc, "127.0.0.1", 12);
ICSharpCode.Core.LoggingService<Program>.Debug("starting workbench...");
Form frmMain = WorkbenchSingleton.Workbench as Form;

@ -33,7 +33,7 @@ namespace Mesnac.PlcUtils
string str = System.Environment.CurrentDirectory;
str = str + "\\Mesnac.PlcUtils.dll";
Assembly assembly = Assembly.LoadFile(str); // 加载程序集EXE 或 DLL
string AssemName = "JSSD.PolarBind.Plc.Impl." + plcType.GetDescription();
string AssemName = "Mesnac.PlcUtils.Impl." + plcType.GetDescription();
var obj = assembly.CreateInstance(AssemName, true);
plcInstance = obj as IPlc;
if (plcInstance == null)
@ -71,7 +71,14 @@ namespace Mesnac.PlcUtils
public bool readBoolValue(string address)
{
return plcInstance.readBoolByAddress(address);
if(plcInstance != null)
{
return plcInstance.readBoolByAddress(address);
}
else
{
return false;
}
}
}

Loading…
Cancel
Save