当我的表单加载时,我想打开一个串口。我知道COM3已经关闭,我知道它是正确的名称(我在设备管理器中看到我的设备为COM3)。这是我的代码:
SerialPort sp = new SerialPort();
sp.PortName = "COM3";
sp.BaudRate = 2400;
sp.Parity = Parity.None;
sp.StopBits = StopBits.One;
sp.DataBits = 8;
sp.Handshake = Handshake.RequestToSend; //DO NOT SET TO NONE
sp.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
sp.Open();
然而,当我编译它时,我被告知设备尚未就绪。我该如何准备呢?