資源簡介
經典的串口收發調試工具,實現了利用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?????????????{
????????????????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個文件信息
- 上一篇:C#實現MVC設計模式源碼
- 下一篇:C# 基本圖形示波器窗口設計源碼
評論
共有 條評論