前言

​ 使用qt开发一款简易串口助手。

​ 目标:

	1. 实现正常串口通信。
2. 能够传输AT指令。(需要注意回车符)

github仓库地址:shadow-wd/Serial-port-assistant: 简易串口助手 (github.com)

还在持续更新.......

开发环境

windows平台:qtcreator 5.9.5

代码

​ 代码量小,注释写在代码中。

QcomboBox

​ 对于下拉选项框来说,有一些选项框需要显示给用户汉字(字符串),但是代码中获取用户选项的时候,不能去匹配汉字。

使用QMap将string和int类型绑定,显示给用户string类型,匹配时通过int类型匹配。

QMap<QString,int> parityvalue;
parityvalue.insert("NoParity",1);
parityvalue.insert("EvenParity",2);
parityvalue.insert("OddParity",3);
parityvalue.insert("SpaceParity",4);
parityvalue.insert("MarkParity",5); // 不知道为什么这里插入的顺序很混乱
foreach (const QString &str, parityvalue.keys()) {
ui->checkbit->addItem(str,parityvalue.value(str));
}

AT指令回车

​ 在开发过程中,接收数据很容易,但是发送AT指令总是失败,经过排查问题发现时AT指令的回车符没能成功识别。

    // 对发送数据追加回车
if(ui->enter->isChecked())
{
bytes.append("\r\n");
}
a= serialPort->write(bytes.data());

​ 因此添加了给数据追加回车的选项框。

Serial port的更多相关文章

  1. Serial Port Programming on Linux(转载)

    This is a tutorial on how to program the Serial Ports on your Linux box.Serial Ports are nice little ...

  2. Serial Port Programming using Win32 API(转载)

    In this tutorial we will learn How to communicate with an external device like a microcontroller boa ...

  3. select/poll/epoll on serial port

    In this article, I will use three asynchronous conferencing--select, poll and epoll on serial port t ...

  4. [转]How Can I Find Out What Is Using a Busy or Reserved Serial Port?

    转自:http://digital.ni.com/public.nsf/allkb/29B079481C5ECE76862578810082394E How Can I Find Out What I ...

  5. 串口总是报'Error opening serial port'

    Comm1.CommName := '//./' + Trim(combx_Port.Text); 目前串口大于20  用上面方法解决的 网上也有上面方法解决如下错误的. 若是您已会应用SPCOMM且 ...

  6. Unable to open serial port /dev/ttyUSB0

    ubuntu12.04使用USB转串口时出现权限不够问题,如下 Unable to open serial port /dev/ttyUSB0 权限不够 解决办法: 通过增加udev规则来实现.步骤如 ...

  7. [原]OS X 10.9 Mavericks - Virtual Serial Port Issues

    If want to do iOS kernel debugging on A4 device, first you should install Virtual COM port (VCP) dri ...

  8. ROS 进阶学习笔记(12) - Communication with ROS through USART Serial Port

    Communication with ROS through USART Serial Port We always need to communicate with ROS through seri ...

  9. Connecting to a Remote Serial Port over TCP/IP

    https://www.acmesystems.it/socat This article illustrates how to realize a lan to serial gateway Rem ...

  10. Non-standard serial port baud rate setting

    ////combuad_recv.cpp #include <stdio.h> /*标准输入输出定义*/ #include <stdlib.h> /*标准函数库定义*/ #in ...

随机推荐

  1. freeswitch开启https,wss

    1.sip.js配置访问wss://域名:7443 2.freeswitch配置certs,使用cat   .pem .key >wss.pem,合成wss证书.需重启freeswitch 3. ...

  2. 学Java的第5天,今天做了个双色球系统

    今天是学JAVA的第5天,刚刚把方法学完,然后就在这做黑马的题. 用了一个多小时时间,把他的 这些题都做完了 但是最后一道题,这个双色球系统我感觉挺有意思的 我看到这个题,分析后感觉需要4种方法: 1 ...

  3. Redis集群模式及工作原理

    Redis有三种集群模式:主从模式.哨兵模式和集群模式. 1. 主从模式 所有的写请求都被发送到主数据库上,再由主数据库将数据同步到从数据库上.主数据库主要用于执行写操作和数据同步,从数据库主要用于执 ...

  4. Typora 基本功能

    Typora 基本功能 typora 下载官网:https://www.typora.io/       "安装到C盘" 基本使用 1.该文件后缀 .md2.六级标题 :ctrl+ ...

  5. django_模型层及ORM介绍

    一.模型层介绍 1.作用:负责跟数据库之间进行通信. 2.django通过驱动mysqlclient与mysql数据库进行通信,所以需要先安装.版本需要是1.3.13以上. 如果直接安装报错,可以直接 ...

  6. NOIP2012普及组

    T2]寻宝 读懂题目!! 是逆时针,第几个有钥匙的房间,还有能够直接上楼的是作为第一个有钥匙的房间,而不是就从这里直接上楼了 #include<iostream> #include< ...

  7. Crypto入门 (十二)转轮机加密

    前言: 杰弗逊转轮加密,可以自己手动排列完成但是繁琐而且容易弄错,还是建议使用编程,我在手动弄得时候就是复制粘贴少了一个字母,弄了很久才发现,如果编程得话,就不会这样拉 转轮机加密: 题目如下: 1: ...

  8. 搭建Angular基础项目学习

    https://stackblitz.com/借助StackBlitz网站可快速开始搭建一个angular项目 一个angular的component包含三项东西 A component class  ...

  9. 使用 IntersectionObserver API 遇到的一些问题

    root 设指定为 document.body 时不会触发更新 See the Pen document.body and IntersectionObserver by y1j2x34 (@y1j2 ...

  10. Java学习文档

    数在计算机中是以二进制形式表示的,分为有符号数和无符号数,原码.反码.补码都是有符号定点数的表示方法.一个有符号定点数的最高位为符号位,0是正,1是负(以8位整数为例),例如0000001 就是+1, ...