qt 串口通信
部分代码如下:
myCom = new Win_QextSerialPort(QString("COM3"),QextSerialBase::EventDriven);
if(!myCom ->open(QIODevice::ReadWrite))
return;
ui->pushButton->setEnabled(false);
myCom->setBaudRate(BAUD9600);
myCom->setDataBits(DATA_8);
myCom->setParity(PAR_NONE);
myCom->setStopBits(STOP_1);
myCom->setTimeout(500);
connect(myCom,SIGNAL(readyRead()),this,SLOT(readCom()));