procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var
i:integer;
Str: String;
rbuf:array[1..1000] of byte;
begin
Move(buffer^,pchar(@rbuf)^,BufferLength);
for i := 1 to BufferLength do
begin
if CheckBox1.Checked then
begin
Str := Str + ' ' + InttoHex(rbuf, 2);
end
else
begin
Str := Str + Chr(rbuf);
end;
end;
Memo1.Text := Memo1.Text + Str;
end;