没这样用的,一般的用法发送时
serialPort.Write(messagesend, 0, messagesend.Length);
接收时
int n = serialPort.BytesToRead;
byte[] buf = new byte[n];//声明一个临时数组存储当前来的串口数据
serialPort.Read(buf, 0, n);//读取缓冲数据
单纯的定义为byte[]是不行的,你得为messagereceive申请好空间。
byte[] messagereceive= new byte[7];
不知道,看不懂