private void comm1_OnComm(object sender, System.EventArgs e)
{
MessageBox.Show("1串口",this.comm1.CommEvent.ToString());
if (this.comm1.CommEvent == 2)
{
char r = ((string)comm1.Input)[0];
if(r==ChangeData.SOH1) //如果有连接请求 05
{
comm1.Output=ChangeData.ACK1.ToString();
str1.Append(r);
txtbox.Text+=r.ToString();
}
else if(r==ChangeData.STX1) //02
{
comm1.Output=ChangeData.ACK1.ToString();
str1.Append(r);
txtbox.Text+=r.ToString();
}
else if(r==ChangeData.ETX1) //结束后处理数据//04
{
comm1.Output=ChangeData.ACK1.ToString();
cdata.ParseData1(str1.ToString(),"comm1"
;
str1.Remove(0,str1.Length);
}
else
{
str1.Append(r);
txtbox.Text+=r.ToString();
}
}
}