-
大小: 508KB文件類型: .zip金幣: 2下載: 0 次發布日期: 2021-06-12
- 語言: 其他
- 標簽:
資源簡介
一款使用與windows(qt開發)的串口軟件,具有接受發送數據,波形顯示,crc16-MODBUS數據解析,保存文件,導入文件并繪制波形的功能。

代碼片段和文件信息
#include?“frmmain.h“
#include?“ui_frmmain.h“
#include?“myhelper.h“
#define?_TIME_?qPrintable?(QTime::currentTime().toString(“hh:mm:ss:zzz“))
frmMain::frmMain(QWidget?*parent)?:
????QWidget(parent)
????ui(new?Ui::frmMain)
{
????ui->setupUi(this);
????myHelper::FormInCenter(this);
????this->InitForm();
????this->InitPlot();
????windows=true;
????lingdian=false;
????stop=true;
?????ui->TXPID->setEnabled(false);
?????ui->cboxSleepTime->setEnabled(false);
????ui->ckHexReceive->setEnabled(false);
????ui->ckHexSend->setEnabled(false);
}
frmMain::~frmMain()
{
????delete?ui;
}
void?frmMain::InitForm()
{
????this->showMaximized();
????MaxCount?=?20000;
????CurrentCount?=?0;
????SleepTime?=?100;
????ReceiveCount?=?0;
????SendCount?=?0;
????IsShow?=?true;
????IsHexSend?=?true;
????IsHexReceive?=?true;
????com?=?0;
????QStringList?comList;//串口號
????QStringList?baudList;//波特率
????QStringList?parityList;//校驗位
????QStringList?dataBitsList;//數據位
????QStringList?stopBitsList;//停止位
#ifdef?Q_OS_WIN32
????comList.clear();
????comList?<“COM1“?<“COM2“?<“COM3“?<“COM4“?<“COM5“?<“COM6“?<“COM7“?<“COM8“;
#endif
#ifdef?Q_OS_LINUX
#ifdef?__arm__
????comList.clear();
????comList?<“ttySAC0“?<“ttySAC1“?<“ttySAC2“?<“ttySAC3“;
#else
????comList.clear();
????comList?<“ttyUSB0“?<“ttyS0“?<“ttyS1“?<“ttyS2“?<“ttyS3“?<“ttyS4“;
#endif
#endif
????ui->cboxPortName->addItems(comList);
????ui->cboxPortName->setCurrentIndex(0);
????baudList?<“50“?<“75“?<“100“?<“134“?<“150“?<“200“?<“300“
?????????????<“600“?<“1200“?<“1800“?<“2400“?<“4800“?<“9600“
?????????????<“14400“?<“19200“?<“38400“?<“56000“?<“57600“
?????????????<“76800“?<“115200“?<“128000“?<“256000“;
????ui->cboxBaudRate->addItems(baudList);
????ui->cboxBaudRate->setCurrentIndex(12);
????parityList?<“無“?<“奇“?<“偶“;
#ifdef?Q_OS_WIN//如果是windows系統
????parityList?<“標志“;
#endif
????parityList?<“空格“;
????ui->cboxParity->addItems(parityList);
????ui->cboxParity->setCurrentIndex(0);
????dataBitsList?<“5“?<“6“?<“7“?<“8“;
????ui->cboxDataBit->addItems(dataBitsList);
????ui->cboxDataBit->setCurrentIndex(3);
????stopBitsList?<“1“;
#ifdef?Q_OS_WIN//如果是windows系統
????stopBitsList?<“1.5“;
#endif
????stopBitsList?<“2“;
????ui->cboxStopBit->addItems(stopBitsList);
????ui->cboxStopBit->setCurrentIndex(0);
????for?(int?i?=?0;?i?<=?500;?i?=?i?+?50)?{
????????ui->cboxSleepTime->addItem(QString::number(i));
????}
????ui->cboxSleepTime->setCurrentIndex(0);
????ui->cboxInterval->addItem(QString::number(100));
????ui->cboxInterval->addItem(QString::number(200));
????ui->cboxInterval->addItem(QString::number(300));
????for?(int?i?=?500;?i?<=?10000;?i?=?i?+?500)?{
????????ui->cboxInterval->addItem(QString::number(i));
????}
????ui->cboxInterval->setCurrentIndex(3);
?//???for?(int?i?=?100;?i?<=?1000;?i?=?i?+?100)?{
?????ui->cboxMaxCou
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-06-05?14:36??com\
?????文件??????480103??2015-03-26?10:12??com\QQ截圖20150321135219.jpg
?????文件?????????955??2019-05-31?09:27??com\com.pro
?????文件???????23908??2019-06-05?14:36??com\com.pro.user
?????文件????????2014??2019-05-21?09:12??com\form.ui
?????文件???????22822??2019-06-05?14:25??com\frmmain.cpp
?????文件????????2144??2019-06-04?09:20??com\frmmain.h
?????文件???????15413??2019-06-04?11:19??com\frmmain.ui
?????文件?????????237??2019-05-23?17:51??com\main.cpp
?????文件????????5432??2019-05-21?15:38??com\myhelper.h
?????文件????????6807??2019-06-03?10:05??com\mythread.cpp
?????文件????????1043??2019-06-03?14:09??com\mythread.h
?????文件??????842538??2014-12-28?06:09??com\qcustomplot.cpp
?????文件??????149211??2014-12-28?06:09??com\qcustomplot.h
?????目錄???????????0??2019-05-08?11:05??com\serialportapi\
?????文件???????32794??2015-03-20?14:05??com\serialportapi\qextserialport.cpp
?????文件????????7245??2015-03-20?14:05??com\serialportapi\qextserialport.h
?????文件????????2641??2015-03-20?14:05??com\serialportapi\qextserialport_global.h
?????文件????????7191??2015-03-20?14:05??com\serialportapi\qextserialport_p.h
?????文件???????15351??2015-03-20?14:05??com\serialportapi\qextserialport_unix.cpp
?????文件???????15069??2015-03-20?14:05??com\serialportapi\qextserialport_win.cpp
評論
共有 條評論