Recent

Author Topic: LazSerial -- ReadUntilChar ??  (Read 2050 times)

HatForCat

  • Sr. Member
  • ****
  • Posts: 293
LazSerial -- ReadUntilChar ??
« on: January 18, 2017, 12:23:50 am »
Using LazSerial and the data stream from the Arduino is coming in at 115200. Each line is terminated with either a "<" or ">" plus #13#10, or #10#13 can't remember.

Is there some way for LazSerial to ReadUntilChar then send that data to a Memo dropping the #13#10 while still continue to gather incoming stuff?

Here's what I was using in TurboPower ADPort in Delphi...

Code: [Select]
procedure TfrmMain.tpPortTriggerAvail(CP: TObject; Count: Word);
var
  i : Word;
  C : Char;
begin
  for i:=1 to Count do
  begin
    C:=tpPort.GetChar;
    case C of
      #0..#31,#127..#255 : {Don't display} ;
      '>','<' : begin
        strIn:=strIn+C;
        HandleIncomingStr;  // Add to Memo etc
      end;
      else strIn:=strIn+C;
    end;
  end;
end;
Acer-i5, 2.6GHz, 6GB, 500GB-SSD, Mint-19.3, Cinnamon Desktop, Lazarus 2.0.6, SQLite3

 

TinyPortal © 2005-2018