/// 开始采集 /// </summary> /// <param name="ControllerOrder"></param> public void StartAcquisition() { _Log.Error(PortName + "---" + PortBaud.ToString()); SerialPort = new SerialPort(PortName, PortBaud, Parity.None, 8, StopBits.One); SerialPort.DataReceived += new SerialDataReceivedEventHandler(SerialPort_DataReceived); IsContinue = true; IsFinished = false; try { if (!SerialPort.IsOpen) { _Log.Error("打开串口"); SerialPort.Open(); byte[] tempByte = DataEncoder.strToToHexByte("A5A5A5A5A5A5A5A5A5A5"); _Log.Error("发送10个A5"); SerialPort.Write(tempByte, 0, tempByte.Length); } } catch (Exception ex) { _Log.Error(ex.ToString()); } }