I use the CiaComPort in Delphi5, and I have a problem. I send a command to the device. I use the Send(Buffer: Pointer; Len: integer): cardinal
function.
procedure TFormMain.CiaComportraParancsotKuld(CNev, Szoveg: WideString; NyoId, PortSzam: Integer);
var
Kar: PChar;
Szam: Integer;
Parancs: WideString;
begin
Parancs := #$0002+'~JS0|'+CNev+'|0|'+Szoveg+#$0003;
Kar := PChar(Parancs);
Szam := length(Parancs)*2;
FormMain.CiaComPort1.Open := True;
FormMain.CiaComPort1.Send(Kar, Szam);
FormMain.CiaComPort1.Open := False;
end;
This procedure is fine, but when I send the command, unfortunately I don't see the coming characters from the device, because In my opinion I do not use the CiaComPort1DataAvailable(Sender: TObject)
well.
//Receive(Buffer: Pointer; Len: integer): cardinal
procedure TForm1.CiaComPort1DataAvailable(Sender: TObject);
var
Kar: PChar;
Szam: Integer;
Parancs: WideString;
begin
Szam := RxCount;
Parancs := WideString(Receive(Kar, Szam)); //I think that's not good.
Memo1.Lines.Add(Parancs);
end;
Unfortunately I can't read the buffer. Do you have any ideas?