Hey everybody,
just got a question if anyone noticed similar problem to mine...
im using qt 4.5 with qexserialport 1.2 alpha
got a device connected to USB Serial Port (FTDI)
I noticed that it actually cant open (or set) the port correctly... like something in windows functions
the application works ok only if i open the chosen port with other program (like putty,realterm etc.) close it and then open it with my application and communication works perfectly... but if i remove a cable and plug it again than windows closes and openes virtual port again and qextserialport cant set it parameters correctly
some examples witch are in the library work the same way
here is my port settings
port = new QextSerialPort(COM, QextSerialPort::EventDriven);
port->setBaudRate(BAUD57600);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_1);
port->setTimeout(500);
port = new QextSerialPort(COM, QextSerialPort::EventDriven);
port->setBaudRate(BAUD57600);
port->setFlowControl(FLOW_OFF);
port->setParity(PAR_NONE);
port->setDataBits(DATA_8);
port->setStopBits(STOP_1);
port->setTimeout(500);
port->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
To copy to clipboard, switch view to plain text mode
read function
//receive data from RS485 ... 422
char data[1024];
//int numBytes;
//int bytesRead;
float var;
port->readLine(data, sizeof(data));
//receive data from RS485 ... 422
char data[1024];
//int numBytes;
//int bytesRead;
QStringList msg_list;
float var;
port->readLine(data, sizeof(data));
To copy to clipboard, switch view to plain text mode
before i had implementation of read() but it was the same
write function
if (port->isOpen()){
port->write(message.toAscii(),
message.length());
}
if (port->isOpen()){
port->write(message.toAscii(),
message.length());
}
To copy to clipboard, switch view to plain text mode
just wanted to add that read and write are in other thread
Bookmarks