先上代码~
void chuanjoushiyan::on_pushButton_clicked()
{
QString portName = "/dev/ttyS0";
myCom = new Posix_QextSerialPort(portName, QextSerialBase::Polling);
//这里QextSerialBase::QueryMode应该使用QextSerialBase::Polling
if(myCom->open(QIODevice::ReadWrite)){
QMessageBox::information(this, tr("打开成功"), tr("已成功打开串口 ") + portName, QMessageBox::Ok);
}else{
QMessageBox::critical(this, tr("打开失败"), tr("未能打开串口 ") + portName + tr("\n该串口设备不存在或已被占用"), QMessageBox::Ok);
return;
}
//设置波特率
myCom->setBaudRate((BaudRateType)9600);
//设置数据位
myCom->setDataBits((DataBitsType)8);
//设置校验
myCom->setParity((ParityType)0);
//设置停止位
myCom->setStopBits((StopBitsType)1);
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(readMyCom()));
//开启读取定时器
timerdly = TIMER_INTERVAL;
timer->start(timerdly);
//设置数据流控制
myCom->setFlowControl(FLOW_OFF);
//设置延时
myCom->setTimeout(TIME_OUT);
}
这是我打开串口的代码~~
程序没有问题~~当我点击这个按钮打开串口时候会出现打开串口成功的消息框,当我点击OK,确定的时候
会出现这样一个提示:Posix_QextSerialPort: 1.5 stop bit operation is not supported by POSIX.
请问这是什么原因?