• 大小: 206KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-08
  • 语言: 其他
  • 标签:

资源简介

vs2017开发的上位机接收下位机工程,原创代码,仅供参考,不够完善,大牛可忽略

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;



namespace WindowsFormsApp1
{
   
    public partial class Form1 : Form
    {
        public byte[] data1;
        public Form1()
        {
            InitializeComponent();
        }
        public SerialPort port1 = new SerialPort(“COM3“ 9600 Parity.None 8 StopBits.One);
        private void Button1_Click(object sender EventArgs e)
        {
            port1.Open();
            port1.DiscardInBuffer();
            port1.DiscardOutBuffer();
            MessageBox.Show(“com3 is opensystem message“);
            System.Threading.Thread.Sleep(1000);

            int t= port1.ReadByte();
            textBox1.Text = Convert.ToString(t);
            MessageBox.Show(“receiving successfulsystem message“);
           


        }

        private void Button2_Click(object sender EventArgs e)
        {
            serialPort1.Close();
        }

        private void Button3_Click(object sender EventArgs e)
        {
            Close();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\.vs\
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\.vs\WindowsFormsApp1\
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\.vs\WindowsFormsApp1\v15\
     文件       52736  2018-09-30 22:17  WindowsFormsApp1(c#)\.vs\WindowsFormsApp1\v15\.suo
     目录           0  2018-09-30 22:16  WindowsFormsApp1(c#)\.vs\WindowsFormsApp1\v15\sqlite3\
     文件      696320  2018-09-30 22:16  WindowsFormsApp1(c#)\.vs\WindowsFormsApp1\v15\sqlite3\storage.ide
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\WindowsFormsApp1\
     文件        1145  2017-09-09 22:15  WindowsFormsApp1(c#)\WindowsFormsApp1.sln
     文件         189  2017-09-09 22:14  WindowsFormsApp1(c#)\WindowsFormsApp1\App.config
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\WindowsFormsApp1\bin\
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\WindowsFormsApp1\bin\Debug\
     文件       10240  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe
     文件         189  2017-09-09 22:14  WindowsFormsApp1(c#)\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config
     文件       22016  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb
     文件        1264  2017-09-10 00:51  WindowsFormsApp1(c#)\WindowsFormsApp1\Form1.cs
     文件        5192  2017-09-10 00:29  WindowsFormsApp1(c#)\WindowsFormsApp1\Form1.Designer.cs
     文件        6211  2017-09-09 22:43  WindowsFormsApp1(c#)\WindowsFormsApp1\Form1.resx
     目录           0  2018-09-30 19:23  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\
     目录           0  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\
     文件         868  2017-09-09 22:15  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        7672  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件           0  2017-09-09 22:14  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2017-09-09 22:14  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2017-09-09 22:14  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
     目录           0  2017-09-09 22:14  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\TempPE\
     文件          42  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache
     文件        4526  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.FileListAbsolute.txt
     文件        1012  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.Cache
     文件        2384  2017-09-09 22:18  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csprojResolveAssemblyReference.cache
     文件       10240  2018-09-30 22:16  WindowsFormsApp1(c#)\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe
............此处省略11个文件信息

评论

共有 条评论

相关资源