C#串口介绍以及简单串口通信程序设计和实现

上传者: coderjyf | 上传时间: 2018-07-04 09:04:32 | 文件大小: 162KB | 文件类型: zip
C#串口介绍以及简单串口通信程序设计实现 源代码和串口程序介绍连接:https://www.cnblogs.com/JiYF/p/6618696.html 本站积分太贵,自己变得。。直接到连接地址下载代码 周末,没事干,写个简单的串口通信工具,也算是本周末曾来过,废话不多,直接到主题 串口介绍   串行接口简称串口,也称串行通信接口或串行通讯接口(通常指COM接口),是采用串行通信方式的扩展接口。(至于再详细,自己百度) 串口应用:   工业领域使用较多,比如:数据采集,设备控制等等,好多都是用串口通信来实现!你要是细心的话,你会发现,目前家用国网智能电能表就具备RS485通信总线(串行总线的一种)与RS232可以相互转化(当然一般,非专业的谁也不会闲的蛋疼,趴电表上瞎看,最多也就看看走了多少度电) RS232 DB9介绍: 1.示意图 2.针脚介绍: 载波检测(DCD) 接受数据(RXD) 发出数据(TXD) 数据终端准备好(DTR) 信号地线(SG) 数据准备好(DSR) 请求发送(RTS) 清除发送(CTS) 振铃指示(RI) 3.实物图: 以下是我购买XX公司的一个usb转串口线:这个头就是一个公头,另一端是一个usb口 笨小孩串口工具运行图: 1.开启程序 2.发送一行字符串HelloBenXH,直接将针脚的发送和接收链接起来就可以测试了(针脚2 接受数据(RXD) 和3 发出数据(TXD))直接链接, C#代码实现:采用SerialPort 1.实例化一个SerialPort [csharp] view plain copy 在CODE上查看代码片派生到我的代码片 private SerialPort ComDevice = new SerialPort(); 2.初始化参数绑定接收数据事件 [csharp] view plain copy 在CODE上查看代码片派生到我的代码片 public void init() { btnSend.Enabled = false; cbbComList.Items.AddRange(SerialPort.GetPortNames()); if (cbbComList.Items.Count > 0) { cbbComList.SelectedIndex = 0; } cbbBaudRate.SelectedIndex = 5; cbbDataBits.SelectedIndex = 0; cbbParity.SelectedIndex = 0; cbbStopBits.SelectedIndex = 0; pictureBox1.BackgroundImage = Properties.Resources.red; ComDevice.DataReceived += new SerialDataReceivedEventHandler(Com_DataReceived);//绑定事件 }

文件下载

资源详情

[{"title":"( 33 个子文件 162KB ) C#串口介绍以及简单串口通信程序设计和实现","children":[{"title":"BenXH","children":[{"title":"运行截图","children":[{"title":"start.png <span style='color:#111;'> 32.45KB </span>","children":null,"spread":false},{"title":"run.png <span style='color:#111;'> 33.18KB </span>","children":null,"spread":false}],"spread":true},{"title":"BenXH.sln <span style='color:#111;'> 1008B </span>","children":null,"spread":false},{"title":"BenXH.v12.suo <span style='color:#111;'> 29.00KB </span>","children":null,"spread":false},{"title":"BXHSerialPort","children":[{"title":"Program.cs <span style='color:#111;'> 502B </span>","children":null,"spread":false},{"title":"frmSerialPort.resx <span style='color:#111;'> 5.68KB </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"Debug","children":[{"title":"BXHSerialPort.csproj.FileListAbsolute.txt <span style='color:#111;'> 1.33KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.csproj.GenerateResource.Cache <span style='color:#111;'> 1.09KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.exe <span style='color:#111;'> 28.00KB </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 6.78KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.csprojResolveAssemblyReference.cache <span style='color:#111;'> 2.16KB </span>","children":null,"spread":false},{"title":"TempPE","children":[{"title":"Properties.Resources.Designer.cs.dll <span style='color:#111;'> 5.00KB </span>","children":null,"spread":false}],"spread":false},{"title":"BXHSerialPort.frmSerialPort.resources <span style='color:#111;'> 180B </span>","children":null,"spread":false},{"title":"BXHSerialPort.pdb <span style='color:#111;'> 41.50KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.Properties.Resources.resources <span style='color:#111;'> 6.60KB </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferences.cache <span style='color:#111;'> 865B </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"bin","children":[{"title":"Release","children":null,"spread":false},{"title":"Debug","children":[{"title":"BXHSerialPort.vshost.exe.manifest <span style='color:#111;'> 490B </span>","children":null,"spread":false},{"title":"BXHSerialPort.exe <span style='color:#111;'> 28.00KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.XML <span style='color:#111;'> 4.59KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.vshost.exe <span style='color:#111;'> 23.65KB </span>","children":null,"spread":false},{"title":"BXHSerialPort.pdb <span style='color:#111;'> 41.50KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"Resources","children":[{"title":"red.png <span style='color:#111;'> 3.06KB </span>","children":null,"spread":false},{"title":"green.png <span style='color:#111;'> 3.04KB </span>","children":null,"spread":false}],"spread":true},{"title":"BXHSerialPort.csproj <span style='color:#111;'> 3.94KB </span>","children":null,"spread":false},{"title":"frmSerialPort.Designer.cs <span style='color:#111;'> 28.33KB </span>","children":null,"spread":false},{"title":"frmSerialPort.cs <span style='color:#111;'> 9.23KB </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1.34KB </span>","children":null,"spread":false},{"title":"Settings.Designer.cs <span style='color:#111;'> 1.07KB </span>","children":null,"spread":false},{"title":"Resources.resx <span style='color:#111;'> 6.28KB </span>","children":null,"spread":false},{"title":"Settings.settings <span style='color:#111;'> 249B </span>","children":null,"spread":false},{"title":"Resources.Designer.cs <span style='color:#111;'> 3.51KB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"img","children":[{"title":"red.png <span style='color:#111;'> 3.06KB </span>","children":null,"spread":false},{"title":"green.png <span style='color:#111;'> 3.04KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}]

评论信息

  • 冬暖夏凉的哇塞 :
    非常好,感谢
    2020-10-14
  • zhaojibolv :
    资源可用,谢谢
    2020-09-24
  • yuzhonglangman :
    资源可用,谢谢
    2020-04-10
  • a290273916 :
    一般般,分数太贵了
    2020-03-29
  • 啤酒 :
    好东西谢谢分享
    2019-11-29

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明