• 大小: 0.14M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: C#  串口  发送  数据  

资源简介


资源截图

代码片段和文件信息

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

using System.Runtime.InteropServices;

namespace Ex13_01
{
    public partial class Form1 : Form
    {
        
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            serialPort1.PortName = “COM1“;
            serialPort1.BaudRate = 9600;
            serialPort1.Open();
            byte[] data = Encoding.Unicode.GetBytes(textBox1.Text);
            string str = Convert.Tobase64String(data);
            serialPort1.WriteLine(str);
            MessageBox.Show(“数据发送成功!““系统提示“);
        }

  

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

     目录          0  2018-08-09 09:37  串口

     目录          0  2017-11-17 11:34  串口\Backup

     目录          0  2017-11-17 11:34  串口\Backup\Ex13_01

     文件       3270  2007-07-11 11:32  串口\Backup\Ex13_01\Ex13_01.csproj

     文件       1163  2007-07-11 11:32  串口\Backup\Ex13_01\Form1.cs

     文件       4923  2007-07-11 11:32  串口\Backup\Ex13_01\Form1.Designer.cs

     文件       6013  2007-07-11 11:32  串口\Backup\Ex13_01\Form1.resx

     文件        466  2007-07-11 11:32  串口\Backup\Ex13_01\Program.cs

     目录          0  2017-11-17 11:34  串口\Backup\Ex13_01\Properties

     文件       1162  2007-07-11 11:32  串口\Backup\Ex13_01\Properties\AssemblyInfo.cs

     文件       2868  2007-07-11 11:32  串口\Backup\Ex13_01\Properties\Resources.Designer.cs

     文件       5612  2007-07-11 11:32  串口\Backup\Ex13_01\Properties\Resources.resx

     文件       1090  2007-07-11 11:32  串口\Backup\Ex13_01\Properties\Settings.Designer.cs

     文件        249  2007-07-11 11:32  串口\Backup\Ex13_01\Properties\Settings.settings

     文件       1113  2007-07-11 11:32  串口\Backup\Ex13_01.sln

     文件      16896  2007-07-11 11:32  串口\Backup\Ex13_01.suo

     目录          0  2017-11-17 11:34  串口\Backup1

     文件       1108  2015-11-21 08:23  串口\Backup1\CHAT.sln

     文件      34816  2015-12-10 09:58  串口\Backup1\CHAT.suo

     目录          0  2017-11-17 11:34  串口\Backup1\Ex13_01

     文件       4920  2015-11-25 13:49  串口\Backup1\Ex13_01\Chat.csproj

     文件        486  2015-11-25 13:49  串口\Backup1\Ex13_01\Chat.csproj.user

     文件      14381  2015-11-28 10:21  串口\Backup1\Ex13_01\Form1.cs

     文件      15685  2015-11-27 09:33  串口\Backup1\Ex13_01\Form1.Designer.cs

     文件       6781  2015-11-27 09:33  串口\Backup1\Ex13_01\Form1.resx

     文件        466  2007-07-11 11:32  串口\Backup1\Ex13_01\Program.cs

     目录          0  2017-11-17 11:34  串口\Backup1\Ex13_01\Properties

     文件       1162  2007-07-11 11:32  串口\Backup1\Ex13_01\Properties\AssemblyInfo.cs

     文件       2838  2015-11-19 23:56  串口\Backup1\Ex13_01\Properties\Resources.Designer.cs

     文件       5612  2007-07-11 11:32  串口\Backup1\Ex13_01\Properties\Resources.resx

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

评论

共有 条评论