diff --git a/ProductionSystem/Forms/HomeFormInfo.cs b/ProductionSystem/Forms/HomeFormInfo.cs index c1319db..bc4d739 100644 --- a/ProductionSystem/Forms/HomeFormInfo.cs +++ b/ProductionSystem/Forms/HomeFormInfo.cs @@ -636,6 +636,10 @@ namespace ProductionSystem.Forms middleIsCanRound = false; Thread.Sleep(Program.ReadPlcRate); + + PWMHelper.Open(); + PWMHelper.Cloud(); + //自动模式 如果是手动模式就是false if (D1004) { diff --git a/ProductionSystem/Untils/PWMDeviceHelper.cs b/ProductionSystem/Untils/PWMDeviceHelper.cs index ac28750..dbf4421 100644 --- a/ProductionSystem/Untils/PWMDeviceHelper.cs +++ b/ProductionSystem/Untils/PWMDeviceHelper.cs @@ -39,8 +39,8 @@ namespace ProductionSystem.Untils _data = new List(); _serialPort = new SerialPort { - PortName = Program.PortName, - BaudRate = Program.BaudRate, + PortName = "COM5", + BaudRate = 9600, Parity = (Parity)Program.Parity, DataBits = Program.DataBits, StopBits = (StopBits)Program.StopBits @@ -138,7 +138,7 @@ namespace ProductionSystem.Untils } } - private (bool isok, string msg) writeData(string sendString) + public (bool isok, string msg) writeData(string sendString) { try { diff --git a/ProductionSystem/Untils/PWMHelper.cs b/ProductionSystem/Untils/PWMHelper.cs index e0a04d3..1aa685d 100644 --- a/ProductionSystem/Untils/PWMHelper.cs +++ b/ProductionSystem/Untils/PWMHelper.cs @@ -1,4 +1,5 @@ -using ProductionSystem_Model.ViewModel.Response.Para; +using DevExpress.Data.Helpers; +using ProductionSystem_Model.ViewModel.Response.Para; namespace ProductionSystem.Untils { @@ -15,6 +16,27 @@ namespace ProductionSystem.Untils { return PWMDeviceHelper.Instance.Run(paraCategory, speed, pointKeyValue); } + + + + public static void Open() + { + string a = + "01 10 00 00 00 0D 1A 00 78 00 00 00 64 01 CC 00 14 00 0A 00 0A 00 32 03 E8 01 90 00 32 00 01 00 01 62 55"; + PWMDeviceHelper.Instance.writeData(a); + + a = "01 06 00 0D 00 01 D9 C9"; + PWMDeviceHelper.Instance.writeData(a); + } + + public static void Cloud() + { + string a = + "01 06 00 0D 00 00 18 09"; + PWMDeviceHelper.Instance.writeData(a); + + + } }