public void TestPlcInsResult() { using (var plc = new MvaOmronPlcLdd()) { plc.NLPLC_Initial("192.168.0.200", 2); var test = plc.Read(EnumMacHalPlcVariable.PC_TO_IC_XPoint.ToString()); plc.Write(EnumMacHalPlcVariable.PC_TO_IC_XPoint.ToString(), 10.0); test = plc.Read(EnumMacHalPlcVariable.PC_TO_IC_XPoint.ToString()); Console.WriteLine(test); } }
public void Connect(string ip = null, int?port = null) { if (ip != null) { this.PlcIp = ip; } if (port != null) { this.PlcPortId = port.Value; } this.PlcLdd = new MvaOmronPlcLdd(); this.PlcLdd.NLPLC_Initial(this.PlcIp, this.PlcPortId); }
public void TestPlcOn() { using (var plc = new MvaOmronPlcLdd()) { plc.NLPLC_Initial("192.168.0.200", 2); plc.Write(EnumMacHalPlcVariable.PC_TO_PLC_CheckClock.ToString(), true); Thread.Sleep(500); var test = plc.Read(EnumMacHalPlcVariable.PC_TO_PLC_CheckClock_Reply.ToString()); Console.WriteLine(test); } }
public void Close() { if (this.PlcLdd != null) { using (var obj = this.PlcLdd) { obj.NLPLC_ClosePort(); this.PlcLdd = null; } } if (this.m_keepConnection != null) { using (var obj = this.m_keepConnection) { obj.Cancel(); SpinWait.SpinUntil(() => obj.IsEnd(), 1000); } this.m_keepConnection = null; } }