Home > Mobile >  QT Qserialport from a serial port receives the data, the frequency more quickly.
QT Qserialport from a serial port receives the data, the frequency more quickly.

Time:09-27

Written application is as follows (serial bika)
Send part:
 QByteArray data=https://bbs.csdn.net/topics/QByteArray::number (0, 2); 
Bika - & gt; Write (data);
Bika - & gt; Write (" \ r \ n ");

Receiving part:
 QByteArray buf. 
Buf=bika - & gt; ReadAll ();
if(! Buf. IsEmpty ())
{
QString STR=UI - & gt; TextEdit_read - & gt; ToPlainText ();
STR +=tr (buf);
The UI - & gt; TextEdit_read - & gt; Append (STR);
STR. The clear ();

}
The else {
The UI - & gt; TextEdit_read - & gt; Append (" no return information ");
}
Buf. The clear ();

Set the return of information to MCU myself: unknown input!
Has determined not single chip problem, because use xcom (serial debugging tools) to 10 ms interval, sending a message without any card

CodePudding user response:

This is not necessarily Qserialport control problems, it is possible that your program processing problems, I also encountered this problem, in c # using xcom test, there is no problem, in writing your own serial assistants will be stuck, then to optimize its own program, there is no problem

CodePudding user response:

I also think yes, I said look at other posts seems to want to use thread, but I am a beginner will not corresponding operations,

CodePudding user response:

Whether it should be the main interface and serial interface operation separation in different threads? Can call functions across threads? Completely white, don't know whether to do so is feasible,

CodePudding user response:

Are you saying that receive data frequency die soon? A serial port in the received data signal when issued, similar SCM interrupt, continuous query, receive data is don't you?

CodePudding user response:

After receiving the readyread have read

CodePudding user response:

Serial port receives the data, data processing and interface best two threads respectively carry out, you can test the separately, and see what the problem is, cause interface caton
  •  Tags:  
  • Qt
  • Related