Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

what is wrong??? rs232 com1

kimtschkimtsch Member Posts: 1
i want to send 'pw' over com1, but no reaction on the device
after this i want to read from the port??

give me a tip please!!!!!!!

___________________________________________________________________

procedure TForm1.Button2Click(Sender: TObject);
begin
text := 'pw';
writefile(Hcomm, text[1],Length(text),WrittenBytes,nil);
if writefile(Hcomm, text[1],Length(text),WrittenBytes,nil) = True
then
edit2.text := 'true'
else
edit2.text := 'False';
end;


procedure TForm1.Button3Click(Sender: TObject);
var
InputBuffer : string;
NumberOfBytesRead: DWord;
Buffer: array [0..255] of char;
i : integer;
begin
if HComm = INVALID_HANDLE_VALUE
then
close;
for i := 0 to 255 do
Buffer[i] := #42;

if readfile (hcomm,buffer,sizeof(buffer),NumberOfBytesRead, nil) = false
then
begin
showmessage ('unable to read from port');
exit;
end;

InputBuffer := '';
for i:= 0 to NumberOfBytesread -1 do
Inputbuffer := Inputbuffer + buffer[i];

edit3.text := inputbuffer;


end;
Sign In or Register to comment.