Giter Club home page Giter Club logo

qtdemo's Introduction

QtDemo

串口波形显示助手

/**程序说明文档 版本1.01/

1.Qt上位机,由串口完成数据通信,分为波形显示面板、基本收发面板和位于底部的串口状态信息面板三部分构成。 2.串口状态信息面板可选择端口(COM口)及波特率,刷新按钮用于检测此时计算机的所有串口并更新,打开按钮用于 打开和关闭串口。RX与TX标签显示串口通信的收发字节数,也可用于判断串口通信是否正在进行,而LineEdit为系统控制辅助显示。 3.基本收发面板用于基本的数据接收,支持发送与接收的ASCII(其实是GBK)与HEX形式发送,对应的按钮功能“顾名思义”即可。特别地,发送框中按下[Ctrl]+[Enter]可快速发送。 4.波形显示面板用于图形化显示下位机发送来的参数,最多支持20个变量的显示,且变量类型均应为float(IEEE754标准)。 5.单击波形显示面板“变量”区的各变量名可设置各个变量显示与否,下方的LineEdit用于显示对应变量在当前光标下的实时值(如无光标则默认显示最新值)。 6.波形显示面板“控制”区的各控件功能“顾名思义”即可,其中“截图”和“保存数据”会在当前程序目录下新建“/SavedData”和“/SavedImage”文件夹。 7.波形显示面板“控制”区的“设置”按钮会弹出设置框,在该设置框的设置应用后,会自动记录到ini文件中,作为下次程序启动的参数信息。

*通讯协议说明: 用户每发送一组参数时,应加上帧识别码以形成完成的一帧数据,用以提高通信的可靠性,具体格式如下

  0x44+0x77+用户数据长度位+用户数据报文 + 用户数据校验位,其中0x44和0x77为帧头,检验为异或校验。

    参考补帧格式代码如下(以下代码为C#示例,具体代码视语言类型和单片机型号而定)
    //UserParam 为用户要发送的参数,类型为string,里面按序存放了float型的用户数据
    byte data[UserParam.Length+4];
    data[0] = 0x44;
        data[1] = 0x77;
        data[2] = Convert.ToByte(UserParam.Length);

        byte check = 0;
        for (int i = 0; i < UserParam.Length; i++)
        {
            data[4 + i] = Convert.ToByte(UserParam[i]);
            check ^= Convert.ToByte(UserParam[i]);
        }
        data[UserParam.Length+3] = check;
  send(data);  //发送函数自行定义   

*另,本程序还有很多不完善的地方,水平有限,见谅。

*本程序由吉林大学某一枚菜鸡个人制作,版权声明无,欢迎免费传播及使用本程序,但您有义务报告在使用发现的BUG。或当您有任何问题,请一并联系 邮箱[email protected]

版本更新说明: v1.00 UI界面完成及基本功能完成 v1.01 修正了 程序可能会显得人性化的 BUG ,hhhh

/****************************************************************************************************************************/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.