C#串口通讯,复制粘贴就可用,仅仅介绍怎样最快的搭建一个串口通讯,异常拦截等等需要自己加上
2021-03-07 04:26
标签:else encoding arch 需求 received text src 读取 tst
C#串口通讯,复制粘贴就可用,仅仅介绍怎样最快的搭建一个串口通讯,异常拦截等等需要自己加上 标签:else encoding arch 需求 received text src 读取 tst 原文地址:https://www.cnblogs.com/lonelyxmas/p/12833867.htmlusing System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Text;
//串口通讯类
public class SerialPortManager
{
//声明一个静态的串口资源
private SerialPort ComDevice = new SerialPort();
public SerialPortManager()
{
var portList = SerialPort.GetPortNames();//获取当前搜索到的串口集合
ComDevice.DataReceived += new SerialDataReceivedEventHandler(Com_DataReceived); //绑定事件,接收到串口数据时触发
}
///
文章标题:C#串口通讯,复制粘贴就可用,仅仅介绍怎样最快的搭建一个串口通讯,异常拦截等等需要自己加上
文章链接:http://soscw.com/index.php/essay/61169.html