• 大小: 174KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-07
  • 语言: C#
  • 标签:

资源简介

VS2010C#串口通信

资源截图

代码片段和文件信息

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            axMSComm1.PortOpen = false;
            Close();

        }
       
        private void Form1_Load(object sender EventArgs e)
        {
         axMSComm1.CommPort = 1; //‘设置通信端口号为COM1
        axMSComm1.Settings = “9600n81“; //‘设置串口参数
        axMSComm1.InputMode = 0 ;//‘接收文本型数据
        axMSComm1.PortOpen =true ;//‘打开通信端口1
          
        }
      
        private void Form1_FormClosing(object sender FormClosingEventArgs e)
        {
            axMSComm1.PortOpen = false;
        }
      
        private void button2_Click(object sender EventArgs e)
        {
            string outdata = textBox2.Text;
           if (outdata  == ““ )
            {
           MessageBox.Show(“发送的数据不能为空!“ ““ );
            }
            axMSComm1.Output =outdata;
        }

        private void timer1_Tick(object sender EventArgs e)
        {
            object  data;
            data = axMSComm1 .Input  ;
            textBox1.Text = textBox1.Text + data;
        }

       
       
      
        
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\WindowsFormsApplication1\
     文件        6802  2012-01-08 17:18  电脑串口之间串口通信\WindowsFormsApplication1\Form1.Designer.cs
     文件        1592  2012-01-08 17:18  电脑串口之间串口通信\WindowsFormsApplication1\Form1.cs
     文件        6739  2012-01-08 17:18  电脑串口之间串口通信\WindowsFormsApplication1\Form1.resx
     文件         505  2011-06-08 21:23  电脑串口之间串口通信\WindowsFormsApplication1\Program.cs
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\WindowsFormsApplication1\Properties\
     文件        1386  2011-06-08 21:23  电脑串口之间串口通信\WindowsFormsApplication1\Properties\AssemblyInfo.cs
     文件        2898  2011-06-08 21:23  电脑串口之间串口通信\WindowsFormsApplication1\Properties\Resources.Designer.cs
     文件        5612  2011-06-08 21:23  电脑串口之间串口通信\WindowsFormsApplication1\Properties\Resources.resx
     文件        1109  2011-06-08 21:23  电脑串口之间串口通信\WindowsFormsApplication1\Properties\Settings.Designer.cs
     文件         249  2011-06-08 21:23  电脑串口之间串口通信\WindowsFormsApplication1\Properties\Settings.settings
     文件        5763  2011-12-29 17:54  电脑串口之间串口通信\WindowsFormsApplication1\WindowsFormsApplication1.csproj
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\WindowsFormsApplication1\bin\
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\
     文件       16384  2011-12-29 18:20  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\AxInterop.DAQAILib.dll
     文件       11776  2011-12-29 18:20  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\AxInterop.MSCommLib.dll
     文件       28672  2011-12-29 18:20  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\Interop.DAQAILib.dll
     文件       15360  2012-01-08 17:07  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\Interop.MSCommLib.dll
     文件       11264  2013-05-08 15:00  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.exe
     文件       34304  2013-05-08 15:00  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.pdb
     文件       14328  2013-05-08 15:00  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe
     文件         490  2007-07-21 01:33  电脑串口之间串口通信\WindowsFormsApplication1\bin\Debug\WindowsFormsApplication1.vshost.exe.manifest
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\WindowsFormsApplication1\obj\
     目录           0  2015-05-10 11:52  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\
     文件       16384  2011-12-29 18:20  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\AxInterop.DAQAILib.dll
     文件       11776  2011-12-29 18:20  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\AxInterop.MSCommLib.dll
     文件       28672  2011-12-29 18:20  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\Interop.DAQAILib.dll
     文件       15360  2012-01-08 17:07  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\Interop.MSCommLib.dll
     文件        6084  2012-01-08 17:08  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\ResolveAssemblyReference.cache
     目录           0  2015-05-10 11:53  电脑串口之间串口通信\WindowsFormsApplication1\obj\Debug\TempPE\
............此处省略11个文件信息

评论

共有 条评论