在c#里使用api函数向串口发指令时,每次写串口成功都要1秒钟,哪位高人指点下是什么问题。串口类是网上下载的JustinIO

解决方案 »

  1.   

    写串口的函数 
    public void Write(byte[] WriteBytes)
            {
                if (hComm != INVALID_HANDLE_VALUE)
                {
                    OVERLAPPED ovlCommPort = new OVERLAPPED();
                    int BytesWritten = 0;
                    WriteFile(hComm, WriteBytes, WriteBytes.Length, ref BytesWritten, ref ovlCommPort);
                }
                else
                {
                    throw (new ApplicationException("串口未打开!"));
                }
            }
      

  2.   

    发的字符不论多少都会有这个问题,网上说JustinIO这个类是异步的呀。