Re: Serial port communications


[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]

Posted by Rbrrneck on December 11, 2002 at 20:23:02:

In Reply to: Serial port communications posted by Olivier Perrin on December 11, 2002 at 15:01:00:

if you don't want to bother with writing your own code, go to torry.net and you'll find lots of great free components, if you want to write your own code try with the write and read procedures
ie.

function GetString (Len:Integer) :string;
var a: array [0..1600] of byte; Nof : integer; i : byte; TStr : string;
begin TStr:=''; if not ReadFile(fPort,a,Len,NOF,NIL) then SetError (GetLastError); for i:=1 to Nof do Tstr:=TStr+Char(a[i-1]); Result:=Tstr; end;
procedure SendByte;
var Nof : integer;
begin if not writeFile (Fport,byt,1,NOF,NIL) then SetError (GetLastError); end;

Related Articles and Replies:


[ Related Articles and Replies ] [ DelphiLand FAQ ] [ Delphi Tutorials ]