• 大小: 492KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-05-24
  • 语言: C#
  • 标签: C#  串口调试  源码  VS2010  

资源简介

经典的串口收发调试工具,实现了利用C# SerialPort串口控件进行(二进制,十进制,十六进制)数据的收发和显示处理; 已经经过测试调试,可用!-----No.2

资源截图

代码片段和文件信息

/*
 * 程序员:王文壮
 * 
 * 用途:串口通讯调试程序
 * 
 * 时间:16:58 2010-1-28
 * 
 */
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using Microsoft.Win32;

namespace SignalDebug
{
    public partial class FormClient : Form
    {
        #region 构造函数&变量

        #region 线程访问UI委托
        private delegate void Set(byte[] buffer RichTextBox richTextBox);
        #endregion

        #region 构造函数
        public FormClient()
        {
            InitializeComponent();

            #region 串口
            string[] serialPortNames = null;
            try
            {
                serialPortNames = SerialPort.GetPortNames();
            }
            catch (Exception ex)
            {
                this.toolStripStatusLabelMsg.Text = “获取计算机COM口列表失败!错误信息:“ + ex.Message;
            }
            for (int i = 0; i < serialPortNames.Length; i++)
            {
                this.toolStripComboBoxSerialPortName.Items.Add(serialPortNames[i]);
            }
            if (this.toolStripComboBoxSerialPortName.Items.Count > 0)
            {
                this.toolStripComboBoxSerialPortName.SelectedIndex = 0;
            }
            #endregion

            #region 波特率
            this.toolStripComboBoxBaudRate.Items.AddRange(new object[] { 1200 2400 4800 9600 14400 19200 38400 56000 57600 115200 128000 256000 });
            this.toolStripComboBoxBaudRate.SelectedIndex = 2;
            #endregion

            #region 数据位
            this.toolStripComboBoxDataBits.Items.AddRange(new object[] { 5 6 7 8 });
            this.toolStripComboBoxDataBits.SelectedIndex = this.toolStripComboBoxDataBits.Items.Count - 1;
            #endregion

            #region 奇偶效验
            this.toolStripComboBoxParity.Items.AddRange(new object[] { Parity.None Parity.Space Parity.Mark Parity.Odd Parity.Even });
            this.toolStripComboBoxParity.SelectedIndex = 0;
            #endregion

            #region 停止位
            this.toolStripComboBoxStopBits.Items.AddRange(new object[] { StopBits.One StopBits.Two });
            this.toolStripComboBoxStopBits.SelectedIndex = 0;
            #endregion

            CreateSerialPort();

            this.toolStripComboBoxSerialPortName.SelectedIndexChanged += new EventHandler(toolStripComboBox_SelectedIndexChanged);
            this.toolStripComboBoxBaudRate.SelectedIndexChanged += new EventHandler(toolStripComboBox_SelectedIndexChanged);
            this.toolStripComboBoxDataBits.SelectedIndexChanged += new EventHandler(toolStripComboBox_SelectedIndexChanged);
            this.toolStripComboBoxParity.SelectedIndexChanged += new EventHandler(toolStripComboBox_SelectedIndexChanged);
            this.toolStripComboBoxStopBits.SelectedIndexChanged += new EventHandler(toolStripComboBox_SelectedIndexChanged);
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2238  2010-01-29 11:51  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\App.ico

     文件      13230  2010-01-31 21:37  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\FormClient.cs

     文件      26020  2010-01-30 15:55  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\FormClient.Designer.cs

     文件      11052  2010-01-30 15:55  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\FormClient.resx

     文件        475  2010-01-29 11:21  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\Program.cs

     文件       1188  2010-01-30 15:55  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\Properties\AssemblyInfo.cs

     文件       2846  2010-01-31 20:58  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\Properties\Resources.Designer.cs

     文件       5612  2010-01-29 11:19  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\Properties\Resources.resx

     文件       1109  2010-01-31 20:59  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\Properties\Settings.Designer.cs

     文件        249  2010-01-29 11:19  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\Properties\Settings.settings

     文件       3627  2010-01-31 20:59  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\SignalDebug.csproj

     文件        533  2010-01-31 20:57  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug\SignalDebug.csproj.user

     文件        927  2010-01-31 21:39  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug.sln

    ..A..H.     23040  2010-01-31 21:41  SignalDebug_C#4.0_VS2010_Oked\Backup\SignalDebug.suo

    .......      4286  2012-03-14 19:45  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\App.ico

     文件       4286  2012-03-14 19:45  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\app.publish\Application Files\C#串口调试助手_1_0_0_0\App.ico.deploy

     文件      31232  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\app.publish\Application Files\C#串口调试助手_1_0_0_0\C#串口调试助手.exe.deploy

     文件       7262  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\app.publish\Application Files\C#串口调试助手_1_0_0_0\C#串口调试助手.exe.manifest

     文件       5488  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\app.publish\C#串口调试助手.application

     文件     495088  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\app.publish\setup.exe

     文件       1673  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\C#串口调试助手.application

     文件      31232  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\C#串口调试助手.exe

     文件       3530  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\C#串口调试助手.exe.manifest

     文件      34304  2012-03-14 19:47  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\C#串口调试助手.pdb

     文件      11608  2012-03-14 19:46  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\C#串口调试助手.vshost.exe

     文件        490  2010-03-17 22:39  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\bin\Release\C#串口调试助手.vshost.exe.manifest

     文件      13253  2012-03-14 19:45  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\FormClient.cs

     文件      26823  2012-03-14 19:45  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\FormClient.Designer.cs

     文件      14088  2012-03-14 19:45  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\FormClient.resx

     文件        633  2010-01-31 21:36  SignalDebug_C#4.0_VS2010_Oked\SignalDebug\obj\Debug\SignalDebug.csproj.FileListAbsolute.txt

............此处省略67个文件信息

评论

共有 条评论