Home > Back-end >  Inquire of serial port receiving data Memo controls use problem
Inquire of serial port receiving data Memo controls use problem

Time:09-28

I made a PC serial port to receive data, the received data shows in the Memo, already set Memo2 - & gt; Lines - & gt; Add (S); But there is some data together is not branches, have come to ask the BBS of everybody, personal doubt is the processing time is too long, send time too fast, send the baud rate is 500000,
Stick receive procedures (control of the serial port using SPCOMM), using the method of the message to receive
Void __fastcall TForm1: : OnShowProgress (TMessage & amp; Msg)
{
If (nbyte> 0)
{
AnsiString S, T;
for(int i=0; I{
T=IntToHex (Buf [I], 2);
If (T.L ength () & gt; 2) T=T.S ubString (7, 2);
S=S + T + "";
}
Memo2 - & gt; Lines - & gt; Add (S);
}
}
Void __fastcall TForm1: : Comm1ReceiveData (TObject * Sender, Pointer Buffer,
WORD BufferLength)
{
Nbyte=BufferLength;
Move (Buffer, Buf, BufferLength);
PostMessage (Handle, WM_SHOW_PROGRESS, NULL, NULL);
}

CodePudding user response:

Branch to \ r \ n you got in your data symbols is done, you yourself to join in a S \ r \ n

CodePudding user response:

In the Memo space so write:
Memo2 - & gt; Lines - & gt; Add (S + "\ r \ n");
  • Related