資源簡介
串口通訊助手C#源代碼,完整的代碼源文件,已驗證,可以使用
代碼片段和文件信息
using?System;
using?System.IO.Ports;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?INIFILE;
using?System.Text.Regularexpressions;
namespace?SerialPortConnection
{
????public?partial?class?Form1?:?Form
????{
????????SerialPort?sp1?=?new?SerialPort();
????????//sp1.ReceivedBytesThreshold?=?1;//只要有1個字符送達端口時便觸發DataReceived事件?
?????????
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????//加載
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????INIFILE.Profile.LoadProfile();//加載所有
????????????
???????????//?預置波特率
????????????switch?(Profile.G_BAUDRATE)
????????????{
????????????????case?“300“:
????????????????????cbBaudRate.SelectedIndex?=?0;
????????????????????break;
????????????????case?“600“:
????????????????????cbBaudRate.SelectedIndex?=?1;
????????????????????break;
????????????????case?“1200“:
????????????????????cbBaudRate.SelectedIndex?=?2;
????????????????????break;?
????????????????case?“2400“:
????????????????????cbBaudRate.SelectedIndex?=?3;
????????????????????break;
????????????????case?“4800“:
????????????????????cbBaudRate.SelectedIndex?=?4;
????????????????????break;
????????????????case?“9600“:
????????????????????cbBaudRate.SelectedIndex?=?5;
????????????????????break;
????????????????case?“19200“:
????????????????????cbBaudRate.SelectedIndex?=?6;
????????????????????break;?
????????????????case?“38400“:
????????????????????cbBaudRate.SelectedIndex?=?7;
????????????????????break;
????????????????case?“115200“:
????????????????????cbBaudRate.SelectedIndex?=?8;
????????????????????break;
????????????????default:
????????????????????{
????????????????????????MessageBox.Show(“波特率預置參數錯誤。“);
????????????????????????return;
????????????????????}??????????????????
????????????}
????????????//預置波特率
????????????switch?(Profile.G_DATABITS)
????????????{
????????????????case?“5“:
????????????????????cbDataBits.SelectedIndex?=?0;
????????????????????break;
????????????????case?“6“:
????????????????????cbDataBits.SelectedIndex?=?1;
????????????????????break;?
????????????????case?“7“:
????????????????????cbDataBits.SelectedIndex?=?2;
????????????????????break;?
????????????????case??“8“:
????????????????????cbDataBits.SelectedIndex?=?3;
????????????????????break;
????????????????default:
????????????????????{
????????????????????????MessageBox.Show(“數據位預置參數錯誤。“);
????????????????????????return;
????????????????????}
????????????}
????????????//預置停止位
????????????switch?(Profile.G_STOP)
????????????{
????????????????case?“1“:
????????????????????cbStop.SelectedIndex?=?0;
????????????????????????break;
????????????????case?“1.5“:
????????????????????cbStop.SelectedIndex?=?1;
????????????????????break;
????????????????case?“2“:
????????????????????cbStop.SelectedIndex?=?2;
????????????????????break;
????????????????default:
????????????????????{
??????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????19760??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Form1.cs
?????文件??????25997??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Form1.Designer.cs
?????文件???????6451??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Form1.resx
?????文件???????7311??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\IniFile.cs
?????文件???????1429??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Profile.cs
?????文件????????491??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Program.cs
?????文件???????1440??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Properties\AssemblyInfo.cs
?????文件???????2798??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Properties\Resources.Designer.cs
?????文件???????5496??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Properties\Resources.resx
?????文件???????1075??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Properties\Settings.Designer.cs
?????文件????????242??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\Properties\Settings.settings
?????文件???????3771??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection\SerialPortConnection.csproj
?????文件????????930??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection.sln
????..A..H.?????27648??2013-12-26?11:53??串口助手C#代碼\串口助手\Backup\SerialPortConnection.suo
?????文件???????2949??2017-01-14?13:15??串口助手C#代碼\串口助手\Cproject20180205_test\app.config
?????文件??????88164??2016-10-13?10:09??串口助手C#代碼\串口助手\Cproject20180205_test\APS168.cs
?????文件??????44499??2016-10-13?10:09??串口助手C#代碼\串口助手\Cproject20180205_test\APS_Define.cs
?????文件???????6025??2018-02-08?14:27??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\ADli
?????文件??????88164??2016-10-13?10:09??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\APS168.cs
?????文件???????1325??2018-02-08?14:27??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\ApsInitLog.log
?????文件??????44499??2016-10-13?10:09??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\APS_Define.cs
?????文件???????5120??2013-08-16?08:39??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\CommonModule.dll
?????文件??????65776??2017-10-26?09:37??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Config\A.cfg
?????文件??????65776??2017-10-26?13:01??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Config\B.cfg
?????文件???????4295??2018-02-08?14:27??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Config\Config.ini
?????文件????????288??2017-09-14?17:04??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Data\0000@201709140000.xm
?????文件????????297??2017-09-14?17:37??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Data\0000@201709141.xm
?????文件????????299??2017-09-14?18:24??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Data\0000@2017091411.xm
?????文件????????299??2017-09-14?17:40??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Data\0000@201709142.xm
?????文件????????302??2017-09-15?10:42??串口助手C#代碼\串口助手\Cproject20180205_test\bin\Debug\Data\0000@201709150000.xm
............此處省略337個文件信息
評論
共有 條評論