Hi,
I'm not sure if this is the correct forum, I.e. Im not sure if its specifically related to the QextSerialPort class or not.
At the moment I am using two USB to Serial adapters connected together to create a connection between COM4 and COM7.
I have set up my program to use COM4 and a terminal program to use COM7.
My program only seems to communicate without errors when I first send some data between COM4 and COM7 using just two terminal programs.
If I don't do this first and I try to send data using my program, for example trying to send "hello" the terminal program simply receives the following: 00 80 80 80 00 00 80 00 80 80 80, in hex.
Or if I send "goodbye" I receive "80 00 80 80 80 80 00 00 00 00 80 00 80 80 00" in hex,
But if I set up two terminal programs between COM4 and COM7 and send some characters between them, which are received fine, then I go back to my program and a terminal program on COM7, then everything works fine from then on, until I restart my computer or something.
Qt Code:
void Loader::send() { QextSerialPort * port = new QextSerialPort("COM4", QextSerialPort::EventDriven); port->setBaudRate(BAUD9600); port->setFlowControl(FLOW_OFF); port->setParity(PAR_NONE); port->setDataBits(DATA_8); port->setStopBits(STOP_1); port->flush(); // I thought this might help but it didn't. port->write("goodbye"); port->close(); }To copy to clipboard, switch view to plain text mode
So it seems I need to initialize something, and by creating communication between two terminal programs I am inadvertently doing this initialization... I'm just not sure what exactly this initialization is and how to implement it in my code...
Hope you can understand what I am trying to say, any help would be really welcome




Reply With Quote


Bookmarks