• 大小: 4.4MB
    文件类型: .rar
    金币: 2
    下载: 2 次
    发布日期: 2023-10-20
  • 语言: C#
  • 标签: C#地面站  

资源简介

上位机实现了串口通信,基本功能包括发送数据,hex、文本数据接收显示等。可按照通信协议接收下位机数据并进行和校验后显示,实时显示包括三轴加速度、角速度、欧拉姿态角等参数信息。实时显示各数据波形,同时可以自由选择需要的显示的数据通道。软件使用VS2008 C#开发,在win7下测试一切正常。

资源截图

代码片段和文件信息

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;
using System.IO.Ports;

namespace quadrotor
{
    public partial class Fonfig_USART : Form
    {
        Form1 fm;
        public Fonfig_USART()
        {
            InitializeComponent();
        }

        private void scan_com()
        {
            string[] ports = SerialPort.GetPortNames();
            Array.Sort(ports);
            comboBox_comname.Items.AddRange(ports);
        }

        private void Fonfig_USART_Load(object sender EventArgs e)
        {
            fm = (Form1)this.Owner; 
            scan_com();//扫描可用串口
            comboBox_comname.SelectedIndex = comboBox_comname.Items.Count > 0 ? 2 : -1;//旋转第一个可用串口
            comboBox_baudrate.SelectedIndex = comboBox_baudrate.Items.IndexOf(“500000“);//选择波特率  
            comboBox_parity_bit.SelectedIndex = comboBox_parity_bit.Items.IndexOf(“无“);
            comboBox_data_bit.SelectedIndex = comboBox_data_bit.Items.IndexOf(“8“);
            comboBox_stop_bit.SelectedIndex = comboBox_stop_bit.Items.IndexOf(“1“);
            
            btn_com_open.Text = “打开串口“;

        }

        private void btn_com_open_Click(object sender EventArgs e)
        {
            if (“打开串口“ == btn_com_open.Text)
            {
                fm.serialPort1.PortName = comboBox_comname.Text;
                fm.serialPort1.BaudRate = int.Parse(comboBox_baudrate.Text);
                fm.serialPort1.Parity   = Parity.None;
                switch (comboBox_parity_bit.SelectedIndex)
                {
                    case 0:
                        fm.serialPort1.Parity = Parity.None;
                        break;
                    case 1:
                        fm.serialPort1.Parity = Parity.Odd;
                        break;
                    case 2:
                        fm.serialPort1.Parity = Parity.Even;
                        break;
                }
                switch (comboBox_data_bit.SelectedIndex)
                {
                    case 0:
                        fm.serialPort1.DataBits = 4;
                        break;
                    case 1:
                        fm.serialPort1.DataBits = 5;
                        break;
                    case 2:
                        fm.serialPort1.DataBits = 6;
                        break;
                    case 3:
                        fm.serialPort1.DataBits = 7;
                        break;
                    case 4:
                        fm.serialPort1.DataBits = 8;
                        break;
                }
                switch (comboBox_stop_bit.SelectedIndex)
                {
                    case 0:
                        fm.serialPort1.StopBits = StopBits.One;
                        break;
                    case 1:
        

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

     文件      67646  2014-11-05 15:39  quadrotor地面站\quadrotor\20140606041332138_easyicon_net_128.ico

     文件     192512  2014-11-08 18:59  quadrotor地面站\quadrotor\bin\Debug\AxInterop.iPlotLibrary.dll

     文件     487424  2014-11-04 11:40  quadrotor地面站\quadrotor\bin\Debug\AxInterop.iProfessionalLibrary.dll

     文件     225280  2014-11-04 19:39  quadrotor地面站\quadrotor\bin\Debug\AxInterop.isDigitalLibrary.dll

     文件      69632  2014-11-08 18:00  quadrotor地面站\quadrotor\bin\Debug\AxInterop.iStripChartXControl.dll

     文件     507904  2014-11-08 18:59  quadrotor地面站\quadrotor\bin\Debug\Interop.iPlotLibrary.dll

     文件     667648  2014-11-04 11:40  quadrotor地面站\quadrotor\bin\Debug\Interop.iProfessionalLibrary.dll

     文件     303104  2014-11-04 19:39  quadrotor地面站\quadrotor\bin\Debug\Interop.isDigitalLibrary.dll

     文件      73728  2014-11-08 18:00  quadrotor地面站\quadrotor\bin\Debug\Interop.iStripChartXControl.dll

     文件     516096  2006-08-18 11:50  quadrotor地面站\quadrotor\bin\Debug\IrisSkin2.dll

     文件       1579  2014-11-11 22:22  quadrotor地面站\quadrotor\bin\Debug\quadrotor.application

     文件     266240  2014-11-11 22:22  quadrotor地面站\quadrotor\bin\Debug\quadrotor.exe

     文件      10159  2014-11-11 22:22  quadrotor地面站\quadrotor\bin\Debug\quadrotor.exe.manifest

     文件      56832  2014-11-11 22:22  quadrotor地面站\quadrotor\bin\Debug\quadrotor.pdb

     文件       1579  2014-11-11 22:22  quadrotor地面站\quadrotor\bin\Debug\quadrotor.vshost.application

     文件      14328  2016-05-24 19:32  quadrotor地面站\quadrotor\bin\Debug\quadrotor.vshost.exe

     文件      33729  2006-03-22 10:24  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\calmness.gif

     文件      20139  2006-03-22 10:16  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\Calmness.ssk

     文件      20271  2006-03-22 10:16  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\CalmnessColor1.ssk

     文件      20208  2006-03-22 10:15  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\CalmnessColor2.ssk

     文件      40436  2006-03-22 10:25  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\calmness_color1.gif

     文件      50601  2006-03-22 10:26  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\calmness_color2.gif

    ..A.SH.     13312  2006-11-10 15:27  quadrotor地面站\quadrotor\bin\Debug\skin\Carlmness\Thumbs.db

     文件      18221  2006-03-22 12:22  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\deepcyan.gif

     文件       5032  2006-04-04 15:20  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\DeepCyan.ssk

     文件      17920  2006-03-22 12:23  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\deepgreen.gif

     文件       5037  2006-03-29 12:12  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\DeepGreen.ssk

     文件      20292  2006-03-22 12:24  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\deeporange.gif

     文件       4908  2006-03-29 12:12  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\DeepOrange.ssk

    ..A.SH.     13312  2006-11-10 15:27  quadrotor地面站\quadrotor\bin\Debug\skin\Deep\Thumbs.db

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

评论

共有 条评论

相关资源