• 大小: 93KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-11
  • 语言: C#
  • 标签:

资源简介

C#串口助手,可实时保存记录,追加时间点

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BL1301_Control
{
    public partial class Form1 : Form
    {

        private bool Listening = false;
        private bool Closing = false;

        public Form1()
        {
            InitializeComponent();

            timer1.Stop();
        }

        int All_S_Bytes = 0;
        int All_R_Bytes = 0;
        int All_R_Line = 0;

        private void Form1_Load(object sender EventArgs e)
        {     
            //设置串口COM1-COM10,默认COM1
            comboSerialPort.Items.Add(“COM1“);
            comboSerialPort.Items.Add(“COM2“);
            comboSerialPort.Items.Add(“COM3“);
            comboSerialPort.Items.Add(“COM4“);
            comboSerialPort.Items.Add(“COM5“);
            comboSerialPort.Items.Add(“COM6“);
            comboSerialPort.Items.Add(“COM7“);
            comboSerialPort.Items.Add(“COM8“);
            comboSerialPort.Items.Add(“COM9“);
            comboSerialPort.Items.Add(“COM10“);
            comboSerialPort.Text = “COM1“;

            //设置波特率,默认9600
            comboBaud.Items.Add(“1200“);
            comboBaud.Items.Add(“2400“);
            comboBaud.Items.Add(“4800“);
            comboBaud.Items.Add(“9600“);
            comboBaud.Items.Add(“14400“);
            comboBaud.Items.Add(“38400“);
            comboBaud.Items.Add(“115200“);
            comboBaud.Text = “9600“;

            //设置数据位,默认8位
            comboDataBit.Items.Add(“7“);
            comboDataBit.Items.Add(“8“);
            comboDataBit.Text = “8“;
            
            //设置停止位,默认1位
            comboStopBit.Items.Add(“1“);
            comboStopBit.Items.Add(“1.5“);
            comboStopBit.Items.Add(“2“);
            comboStopBit.Text = “1“;

            //设置奇偶校验位,默认无
            comboParityBit.Items.Add(“None“);
            comboParityBit.Items.Add(“Odd“);
            comboParityBit.Items.Add(“Even“);
            comboParityBit.Items.Add(“Mark“);
            comboParityBit.Items.Add(“Space“);
            comboParityBit.Text = “None“;

            //接收框设置为只读
            richTextReceive.ReadOnly = true;

            //串口接收数据叠加
            serialPort1.DataReceived += serialPort1_DataReceived;

        }

        //串口号
        private void comboSerialPort_SelectedIndexChanged(object sender EventArgs e)
        {
            serialPort1.PortName = comboSerialPort.Text;
        }

        //波特率
        private void comboBaud_SelectedIndexChanged(object sender EventArgs e)
        {
            serialPort1.BaudRate = int.Parse(comboBaud.Text);
        }

        //数据位
        private void comboDataBit_SelectedIndexChanged(object sender EventArgs e)
        {
            serialPort1.DataBits = int.Parse(comboDataBit.Text);
        }

        //停止位
        private void co

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

     文件      19456  2017-01-02 16:08  BL1301_Control\BL1301_Control\bin\Debug\BL1301_Control.exe

     文件      36352  2017-01-02 16:08  BL1301_Control\BL1301_Control\bin\Debug\BL1301_Control.pdb

     文件      11600  2017-01-02 16:08  BL1301_Control\BL1301_Control\bin\Debug\BL1301_Control.vshost.exe

     文件      18944  2017-01-02 16:00  BL1301_Control\BL1301_Control\bin\Release\BL1301_Control.exe

     文件      30208  2017-01-02 16:00  BL1301_Control\BL1301_Control\bin\Release\BL1301_Control.pdb

     文件      11600  2017-01-02 16:08  BL1301_Control\BL1301_Control\bin\Release\BL1301_Control.vshost.exe

     文件        490  2010-03-17 22:39  BL1301_Control\BL1301_Control\bin\Release\BL1301_Control.vshost.exe.manifest

     文件       3730  2016-12-31 16:37  BL1301_Control\BL1301_Control\BL1301_Control.csproj

     文件      10832  2017-01-02 16:00  BL1301_Control\BL1301_Control\Form1.cs

     文件      19302  2017-01-02 14:48  BL1301_Control\BL1301_Control\Form1.Designer.cs

     文件       6384  2017-01-02 14:48  BL1301_Control\BL1301_Control\Form1.resx

     文件        890  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.csproj.FileListAbsolute.txt

     文件        975  2017-01-02 15:57  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.csproj.GenerateResource.Cache

     文件       9040  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.csprojResolveAssemblyReference.cache

     文件      19456  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.exe

     文件        180  2017-01-02 15:57  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.Form1.resources

     文件      36352  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.pdb

     文件        180  2017-01-02 15:57  BL1301_Control\BL1301_Control\obj\x86\Debug\BL1301_Control.Properties.Resources.resources

     文件       5359  2017-01-01 14:40  BL1301_Control\BL1301_Control\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       6307  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        771  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Release\BL1301_Control.csproj.FileListAbsolute.txt

     文件        975  2017-01-02 16:00  BL1301_Control\BL1301_Control\obj\x86\Release\BL1301_Control.csproj.GenerateResource.Cache

     文件      18944  2017-01-02 16:00  BL1301_Control\BL1301_Control\obj\x86\Release\BL1301_Control.exe

     文件        180  2017-01-02 16:00  BL1301_Control\BL1301_Control\obj\x86\Release\BL1301_Control.Form1.resources

     文件      30208  2017-01-02 16:00  BL1301_Control\BL1301_Control\obj\x86\Release\BL1301_Control.pdb

     文件        180  2017-01-02 16:00  BL1301_Control\BL1301_Control\obj\x86\Release\BL1301_Control.Properties.Resources.resources

     文件       5359  2017-01-02 16:08  BL1301_Control\BL1301_Control\obj\x86\Release\DesignTimeResolveAssemblyReferences.cache

     文件       6311  2017-01-02 16:00  BL1301_Control\BL1301_Control\obj\x86\Release\DesignTimeResolveAssemblyReferencesInput.cache

     文件        495  2016-12-31 09:38  BL1301_Control\BL1301_Control\Program.cs

     文件       1360  2016-12-31 09:34  BL1301_Control\BL1301_Control\Properties\AssemblyInfo.cs

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

评论

共有 条评论