c_串口通信程序.pdfVIP

  • 24
  • 0
  • 约8.57千字
  • 约 9页
  • 2016-03-15 发布于山西
  • 举报
c_串口通信程序

2010 串口通信程序 用VC#2008 实现 实现检测那些串口是可用的,实现对串口的读写操作 彭军 利达光电股份有限公司 2010/4/23 2010 年4 月 串口通信程序 23 日 利达光电股份有限公司 | 彭军 2 2010 年4 月 串口通信程序 23 日 “检测串口”可以将可用的串口保留,删除无用的串口。 主要程序 : using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; namespace SerialComMaster { public partial class MainFrm : Form { SerialPort sp = null ; bool isOpen = false; bool isSetProperty = false ; public MainFrm() { InitializeComponent(); } private void MainFrm_Load(object sender, EventArgs e) { this.MaximumSize = this.Size; 利达光电股份有限公司 | 彭军 3 2010 年4 月 串口通信程序 23 日 this.MinimumSize = this.Size; this.MaximizeBox = false; for (int i = 0; i 256; i++) { cbxCOMPort.Items.Add(COM + (i+1).ToString()); } cbxCOMPort.SelectedIndex=0; //列出常用的波特率 cbxBaudRate.Items.Add(300); cbxBaudRate.Items.Add(600); cbxBaudRate.Items.Add(1200); cbxBaudRate.Items.Add(2400); cbxBaudRate.Items.Add(4800); cbxBaudRate.Items.Add(9600); cbxBaudRate.Items.Add(19200); cbxBaudRate.Items.Add(38400); cbxBaudRate.Items.Add(43000);

文档评论(0)

1亿VIP精品文档

相关文档