在vs2010中调试运行,功能都完整,为什么在debug下运行exe文件。功能就会出现问题
自己认为是接受数据的时候发生了延迟。
comm_DataReceived 接受代码:
int n = serialPort1.BytesToRead;
byte[] buf = new byte[n];
serialPort1.Read(buf, 0, n);
buffer.AddRange(buf);
if (!isDataReceived)
{
buffer.Clear();
isDataReceived = false;
bindControlDetail();
}
else
{
if (buffer.Count == 9)
{
if (buffer[0] == 0xee && buffer[1] == 0xff)
{
//byte[] binary_data_1 = new byte[9];
buffer.CopyTo(0, binary_data_1, 0, 9);
reader = CommonUtil.CommonUtil.byteToHexStr(binary_data_1);
buffer.Clear();
analysisRuningTimeControlData();//解析
}
}
if (buffer.Count > 9)
{
buffer.Clear();
}
}
请教各位大神,帮忙看看!!!!