下载地址:
下载地址1资源简介:
C#WinForm串口调试工具源码功能介绍:运行本程序,在“发送数据”文本框中输入要传送的数据,单击【发送】按钮,将传送的数据发送到所选择 的端口号中主要代码: private void btnOpenPort_Click(object sender, EventArgs e) { if (!openState) { openState = true;//已经打开 btnOpenPort.Text = "关闭串口"; this.pictureBox.Image = global::SerialDemo.Properties.Resources.btnOk2; strPortName = cmbPort.Text; strBaudRate = cmbBaudRate.Text; strDataBits = cmbDataBits.Text; strStopBits = cmbStopBit.Text; sp.PortName = strPortName; sp.BaudRate = int.Parse(strBaudRate); sp.DataBits = int.Parse(strDataBits); sp.StopBits = (StopBits)int.Parse(strStopBits); sp.ReadTimeout = 500; //打开 sp.Open(); sp.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived); } else { openState = false; btnOpenPort.Text = "打开串口"; this.pictureBox.Image = global::SerialDemo.Properties.Resources.can1; sp.DataReceived -= new SerialDataReceivedEventHandler(sp_DataReceived); sp.Close(); } }
飞网下载站,免费下载共享资料,内容涉及教育资源、专业资料、IT资源、娱乐生活、经济管理、办公文书、游戏资料等。