搜索
bottom↓
12
返回列表 发新帖
楼主: lvhaian

串口调试专家, C# 写的串口调试工具

  [复制链接]

出0入0汤圆

发表于 2013-6-17 09:22:01 | 显示全部楼层
哦,我来学习下。提供源码就好了。自己写的那个缓冲区处理不好。

出0入0汤圆

发表于 2013-6-22 16:54:35 | 显示全部楼层
自动断帧 这个功能挺好;
不过,对于硬件调试的人来说,能加上Commix的那个自动校验功能就好了……

出0入0汤圆

发表于 2013-7-31 00:33:10 | 显示全部楼层
楼主可不可以提供 一下源码

出0入0汤圆

发表于 2013-7-31 20:15:49 | 显示全部楼层
有时间也应该学学 C#,当玩了,是不是我会C++学C SHARP会容易一些呢 ?

出0入0汤圆

发表于 2013-8-10 13:07:20 | 显示全部楼层
期待开源早点到来,界面和PortHelper有些相似

出0入0汤圆

发表于 2013-8-25 13:11:07 | 显示全部楼层
学习这方面的知识 求开源呀

出0入0汤圆

发表于 2013-8-26 10:01:41 | 显示全部楼层
楼主信誉何在?答应了网友的开源,哎.........

出0入4汤圆

发表于 2013-8-26 12:33:38 | 显示全部楼层
开源呢??

出0入0汤圆

发表于 2013-9-15 19:40:33 | 显示全部楼层
那个串口示波器才是亮点哈

出0入0汤圆

发表于 2014-1-12 15:32:45 | 显示全部楼层
本帖最后由 QQ373466062 于 2014-1-12 16:04 编辑

不错的东西 示波器那边特别好 谢谢

出0入0汤圆

发表于 2014-1-12 21:25:38 | 显示全部楼层
答应的开源呢,支持下楼主

出0入0汤圆

发表于 2014-1-12 21:49:43 | 显示全部楼层
谢谢楼主分享!

出0入0汤圆

发表于 2014-4-12 15:05:43 | 显示全部楼层
有源码给吗,学习下

出0入0汤圆

发表于 2014-4-12 20:15:42 | 显示全部楼层
楼主,现在程序稳定了么?能开放么?最近在学C#,想找些项目代码看看。

出0入4汤圆

发表于 2014-4-12 21:51:56 | 显示全部楼层
多谢楼主分享,但是CPU占用率一直在40%以上,太伤不起了,楼主能否改进下?

出0入0汤圆

发表于 2014-8-9 21:15:01 | 显示全部楼层
木有源码,就不下了,这样的稳定可以使用的工具多了去

出0入0汤圆

发表于 2015-1-12 13:22:09 | 显示全部楼层
标记,谢谢分享

出0入0汤圆

发表于 2015-1-12 20:34:37 | 显示全部楼层
哇塞。LZ学习了一周就对C#领悟的这么透彻了啊!!

出0入0汤圆

发表于 2015-1-12 21:15:19 | 显示全部楼层
楼主威武哈!

出0入0汤圆

发表于 2015-1-12 21:19:52 | 显示全部楼层
看看好不好用···

出0入0汤圆

发表于 2015-1-12 21:39:24 | 显示全部楼层
可以显示汉字的么。。

出0入0汤圆

发表于 2015-1-18 15:15:12 | 显示全部楼层
串口调试助手

出0入0汤圆

发表于 2015-1-18 17:01:48 | 显示全部楼层
这个东东如果出现热插拔会怎么样啊,楼主大人

出0入0汤圆

发表于 2015-1-18 17:24:21 | 显示全部楼层
不错,顶顶顶!

出0入0汤圆

发表于 2015-1-18 17:52:54 | 显示全部楼层
收藏一个

出0入0汤圆

发表于 2015-1-19 08:46:45 | 显示全部楼层
好东西,不错

出0入0汤圆

发表于 2015-1-19 09:31:06 | 显示全部楼层
收藏,好东西

出0入0汤圆

发表于 2015-1-21 17:56:43 | 显示全部楼层
mark it, thank's

出0入0汤圆

发表于 2015-1-22 16:24:17 | 显示全部楼层
好东西,赞一个

出0入0汤圆

发表于 2015-2-2 11:48:34 | 显示全部楼层
标记一下~ 其实c#是一种中间语言,只要不过5秒就可以得到可编译源码了!

出0入0汤圆

发表于 2015-3-1 15:22:25 | 显示全部楼层
  1. using System;
  2. using System.IO;
  3. using System.IO.Ports;
  4. using System.Text;
  5. using System.Threading;
  6. namespace Termie
  7. {
  8.         public sealed class CommPort
  9.         {
  10.                 public delegate void EventHandler(string param);
  11.                 private SerialPort _serialPort;
  12.                 private Thread _readThread;
  13.                 private volatile bool _keepReading;
  14.                 private static readonly CommPort instance;
  15.                 public CommPort.EventHandler StatusChanged;
  16.                 public CommPort.EventHandler DataReceived;
  17.                 public static CommPort Instance
  18.                 {
  19.                         get
  20.                         {
  21.                                 return CommPort.instance;
  22.                         }
  23.                 }
  24.                 public bool IsOpen
  25.                 {
  26.                         get
  27.                         {
  28.                                 return this._serialPort.IsOpen;
  29.                         }
  30.                 }
  31.                 static CommPort()
  32.                 {
  33.                         CommPort.instance = new CommPort();
  34.                 }
  35.                 private CommPort()
  36.                 {
  37.                         this._serialPort = new SerialPort();
  38.                         this._readThread = null;
  39.                         this._keepReading = false;
  40.                 }
  41.                 private void StartReading()
  42.                 {
  43.                         if (!this._keepReading)
  44.                         {
  45.                                 this._keepReading = true;
  46.                                 this._readThread = new Thread(new ThreadStart(this.ReadPort));
  47.                                 this._readThread.Start();
  48.                         }
  49.                 }
  50.                 private void StopReading()
  51.                 {
  52.                         if (this._keepReading)
  53.                         {
  54.                                 this._keepReading = false;
  55.                                 this._readThread.Join();
  56.                                 this._readThread = null;
  57.                         }
  58.                 }
  59.                 private void ReadPort()
  60.                 {
  61.                         while (this._keepReading)
  62.                         {
  63.                                 if (this._serialPort.IsOpen)
  64.                                 {
  65.                                         byte[] array = new byte[this._serialPort.ReadBufferSize + 1];
  66.                                         try
  67.                                         {
  68.                                                 int count = this._serialPort.Read(array, 0, this._serialPort.ReadBufferSize);
  69.                                                 string @string = Encoding.GetEncoding("Gb2312").GetString(array, 0, count);
  70.                                                 this.DataReceived(@string);
  71.                                         }
  72.                                         catch (TimeoutException)
  73.                                         {
  74.                                         }
  75.                                 }
  76.                                 else
  77.                                 {
  78.                                         TimeSpan timeout = new TimeSpan(0, 0, 0, 0, 50);
  79.                                         Thread.Sleep(timeout);
  80.                                 }
  81.                         }
  82.                 }
  83.                 public void Open()
  84.                 {
  85.                         this.Close();
  86.                         try
  87.                         {
  88.                                 this._serialPort.PortName = Settings.Port.PortName;
  89.                                 this._serialPort.BaudRate = Settings.Port.BaudRate;
  90.                                 this._serialPort.Parity = Settings.Port.Parity;
  91.                                 this._serialPort.DataBits = Settings.Port.DataBits;
  92.                                 this._serialPort.StopBits = Settings.Port.StopBits;
  93.                                 this._serialPort.Handshake = Settings.Port.Handshake;
  94.                                 this._serialPort.Encoding = Encoding.GetEncoding("Gb2312");
  95.                                 this._serialPort.ReadTimeout = 50;
  96.                                 this._serialPort.WriteTimeout = 50;
  97.                                 this._serialPort.Open();
  98.                                 this.StartReading();
  99.                         }
  100.                         catch (IOException)
  101.                         {
  102.                                 this.StatusChanged(string.Format("{0} does not exist", Settings.Port.PortName));
  103.                         }
  104.                         catch (UnauthorizedAccessException)
  105.                         {
  106.                                 this.StatusChanged(string.Format("{0} already in use", Settings.Port.PortName));
  107.                         }
  108.                         catch (Exception ex)
  109.                         {
  110.                                 this.StatusChanged(string.Format("{0}", ex.ToString()));
  111.                         }
  112.                         if (this._serialPort.IsOpen)
  113.                         {
  114.                                 string text = this._serialPort.Parity.ToString().Substring(0, 1);
  115.                                 string text2 = this._serialPort.Handshake.ToString();
  116.                                 if (this._serialPort.Handshake == Handshake.None)
  117.                                 {
  118.                                         text2 = "no handshake";
  119.                                 }
  120.                                 this.StatusChanged(string.Format("{0}: {1} bps, {2}{3}{4}, {5}", new object[]
  121.                                 {
  122.                                         this._serialPort.PortName,
  123.                                         this._serialPort.BaudRate,
  124.                                         this._serialPort.DataBits,
  125.                                         text,
  126.                                         (int)this._serialPort.StopBits,
  127.                                         text2
  128.                                 }));
  129.                         }
  130.                         else
  131.                         {
  132.                                 this.StatusChanged(string.Format("{0} already in use", Settings.Port.PortName));
  133.                         }
  134.                 }
  135.                 public void Close()
  136.                 {
  137.                         this.StopReading();
  138.                         this._serialPort.Close();
  139.                         this.StatusChanged("connection closed");
  140.                 }
  141.                 public string[] GetAvailablePorts()
  142.                 {
  143.                         return SerialPort.GetPortNames();
  144.                 }
  145.                 public int Send(string data)
  146.                 {
  147.                         int result;
  148.                         if (this.IsOpen)
  149.                         {
  150.                                 try
  151.                                 {
  152.                                         this._serialPort.Write(data);
  153.                                         result = data.Length;
  154.                                         return result;
  155.                                 }
  156.                                 catch (Exception ex)
  157.                                 {
  158.                                         this._serialPort.Close();
  159.                                         this.StatusChanged(ex.Message);
  160.                                         result = 0;
  161.                                         return result;
  162.                                 }
  163.                         }
  164.                         result = 0;
  165.                         return result;
  166.                 }
  167.                 public bool ShowCTS()
  168.                 {
  169.                         bool result;
  170.                         try
  171.                         {
  172.                                 result = this._serialPort.CtsHolding;
  173.                         }
  174.                         catch (Exception ex)
  175.                         {
  176.                                 this.StatusChanged(ex.Message);
  177.                                 result = false;
  178.                         }
  179.                         return result;
  180.                 }
  181.                 public bool ShowDSR()
  182.                 {
  183.                         bool result;
  184.                         try
  185.                         {
  186.                                 result = this._serialPort.DsrHolding;
  187.                         }
  188.                         catch (Exception ex)
  189.                         {
  190.                                 this.StatusChanged(ex.Message);
  191.                                 result = false;
  192.                         }
  193.                         return result;
  194.                 }
  195.                 public bool ShowRLSD()
  196.                 {
  197.                         bool result;
  198.                         try
  199.                         {
  200.                                 result = this._serialPort.CDHolding;
  201.                         }
  202.                         catch (Exception ex)
  203.                         {
  204.                                 this.StatusChanged(ex.Message);
  205.                                 result = false;
  206.                         }
  207.                         return result;
  208.                 }
  209.                 public bool ShowRING()
  210.                 {
  211.                         bool result;
  212.                         try
  213.                         {
  214.                                 result = false;
  215.                         }
  216.                         catch (Exception ex)
  217.                         {
  218.                                 this.StatusChanged(ex.Message);
  219.                                 result = false;
  220.                         }
  221.                         return result;
  222.                 }
  223.                 public void SelDTR(bool stat)
  224.                 {
  225.                         try
  226.                         {
  227.                                 this._serialPort.DtrEnable = stat;
  228.                         }
  229.                         catch (Exception ex)
  230.                         {
  231.                                 this.StatusChanged(ex.Message);
  232.                                 this._serialPort.DtrEnable = false;
  233.                         }
  234.                 }
  235.                 public void SelRTS(bool stat)
  236.                 {
  237.                         try
  238.                         {
  239.                                 this._serialPort.RtsEnable = stat;
  240.                         }
  241.                         catch (Exception ex)
  242.                         {
  243.                                 this.StatusChanged(ex.Message);
  244.                                 this._serialPort.RtsEnable = false;
  245.                         }
  246.                 }
  247.                 public void SelBREAK(bool stat)
  248.                 {
  249.                         try
  250.                         {
  251.                                 this._serialPort.BreakState = stat;
  252.                         }
  253.                         catch (Exception ex)
  254.                         {
  255.                                 this.StatusChanged(ex.Message);
  256.                                 this._serialPort.BreakState = false;
  257.                         }
  258.                 }
  259.         }
  260. }
复制代码

出0入0汤圆

发表于 2017-1-4 20:48:03 | 显示全部楼层
楼主能把源码发我一下吗 recoo_001@163.com?我也是初学者 非常感谢。

出0入0汤圆

发表于 2017-1-4 23:14:39 | 显示全部楼层
期待楼主开源

出0入0汤圆

发表于 2017-3-23 17:12:32 | 显示全部楼层
楼主历害,谢谢了!

出0入0汤圆

发表于 2017-3-24 09:07:42 | 显示全部楼层
牛,一直在找一款合适的串口工具

出0入0汤圆

发表于 2017-3-24 10:00:20 | 显示全部楼层
收藏了!

出0入0汤圆

发表于 2017-3-25 15:17:08 | 显示全部楼层
中英文混合发送会不会有问题。 楼主可以入一下wpf的坑。。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-6 20:32

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表