日期:2014-05-17 浏览次数:20947 次
if (serialPort1.IsOpen) { rxByteLength = serialPort1.BytesToRead;//获得长度 if (rxByteLength > 0) { rxBytes = new byte[rxByteLength]; serialPort1.Read(rxBytes, 0, rxByteLength);//存至数组 rxNumber += rxByteLength;//rx计数器加1 textBoxRx.Text = "RX:" + rxNumber.ToString();//显数计数 if (button停止显示.Text == "停止显示") { if (checkBox16进制显示.Checked) { for (int i = 0; i < rxByteLength; i++) { rxString += rxBytes[i].ToString("x2").ToUpper() + " ";//转为string check01(rxBytes[i].ToString("x2").ToUpper() + " "); //check01(this.textBox接收.Text); } }