为什么写入到串口里面了 却没有数据
byte[] SendData=Encoding.ASCII.GetBytes(textBox1.Text);
byte[] ReceiveData=Encoding.ASCII.GetBytes(textBox2.Text);
int Overtime=300;
serialPort1.DiscardInBuffer(); //清空接收缓冲区 serialPort1.Write(SendData, 0, SendData.Length);
System.Threading.Thread.Sleep(50);
int num = 0, ret = 0;
while (num++ < Overtime)
{
if (serialPort1.BytesToRead>= ReceiveData.Length)
{
break;
}
System.Threading.Thread.Sleep(50);
}
为什么serialPort1.BytesToRade 这里面没有值? 改成serialPort1.BytesToWrite也没有值 我明明写入了啊。求高手帮忙
------解决方案--------------------