TComPort inside a Thread

1.1k views Asked by At

How can i use TComport, from inside a thread (e.g OTL or Jedi Thread) to catch incoming strings? What the "SyncMethod" of TComport actually does? This is my code:

procedure TForm5.ComPort1RxChar(Sender: TObject; Count: Integer);
var
  Str:string;
  commapos:integer;
begin
  ComPort1.ReadStr(Str, Count);
  commapos:=System.Pos(',',str);
  if (commapos>0) then
    // Do Something
  else
    // Do Something else
end;

The above question can be implemented via TurboPower Async Pro with better resaults?

Thanks in advance.

P.S. It is a must to read incoming strings from a ComPort using a background worker.

0

There are 0 answers