- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.IO.Ports;
- using System.Threading;
- namespace CommPort
- {
- enum optype
- {
- Continues,
- Orders
- }
- /// <summary>
- /// 串口操作类
- /// </summary>
- public class CommOp
- {
- private SerialPort commport ;
- List<byte> list = new List<byte>();
- /// <summary>
- /// 设置标示位,防止close时存在I/O操作
- /// </summary>
- bool sign = false;
- /// <summary>
- /// 自定义串口操作类构造函数
- /// </summary>
- /// <param name="sp"></param>
- public CommOp(SerialPort sp)
- {
- this.commport = sp;
- }
- public CommOp()
- {
- }
- /// <summary>
- /// 连续方式获得磅秤数据,注意磅秤设备应该标定为"连续方式"
- /// </summary>
- /// <
自定义串口通信类的实现(SerialPort)
最新推荐文章于 2021-05-01 13:21:07 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)