unity 串口通讯中的问题

一般的数据接收都是没问题的是使用线程去接收
但是在发送数据的情况下 串口的接收会丢失一位数据
if (SendCom.Count != 0)
{
string index = SendCom.Dequeue();
try
{

                byte[] index1 = PortControl.strToToHexByte(index);
                myport.Write(index1, 0, index1.Length);                   
                myport.DiscardOutBuffer();
                myport.DiscardInBuffer();
                Thread.Sleep(20);
            }
            catch
            {

            }

        }
        try
        {
            datapool.Enqueue(myport.ReadByte().ToString("X2"));
            //string d = myport.ReadExisting();
            //Debug.Log(d);

        }
        catch
        {
            // myport.DiscardInBuffer();
            //Debug.Log(ex);
        }
                    我试过这样在发送的时候暂停线程来解决 但是最终效果还是不是很理想 

一般避免数据丢失的方法都是用校验位来做的。

具体方法可以看看这个
https://blog.csdn.net/dagefeijiqumeiguo/article/details/68921727