H
hangyang
Unregistered / Unconfirmed
GUEST, unregistred user!
我用mscomm控件写的串口收发程序。把232的2,3两脚短接。用edit1来发送字符,
edit2用来接收字符。但点击发送键edit2却没有收到。用串口调试助手可以收发。
procedure TForm1.FormCreate(Sender: TObject);
begin
if MSComm1.PortOpen then
MSComm1.PortOpen := false;
MSComm1.CommPort := 1;
MSComm1.Settings := '9600,n,8,1';
MSComm1.InputLen := 0;
MSComm1.InBufferCount := 0;
MSComm1.OutBufferCount:=0;
MSComm1.RThreshold := 32;
MSComm1.PortOpen := true;
end;
procedure TForm1.MSComm1Comm(Sender: TObject);
begin
Edit2.Test:=Mscomm1.Input;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Mscomm1.Output:=Edit1.Test;
end;
请前辈们指点一下
edit2用来接收字符。但点击发送键edit2却没有收到。用串口调试助手可以收发。
procedure TForm1.FormCreate(Sender: TObject);
begin
if MSComm1.PortOpen then
MSComm1.PortOpen := false;
MSComm1.CommPort := 1;
MSComm1.Settings := '9600,n,8,1';
MSComm1.InputLen := 0;
MSComm1.InBufferCount := 0;
MSComm1.OutBufferCount:=0;
MSComm1.RThreshold := 32;
MSComm1.PortOpen := true;
end;
procedure TForm1.MSComm1Comm(Sender: TObject);
begin
Edit2.Test:=Mscomm1.Input;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Mscomm1.Output:=Edit1.Test;
end;
请前辈们指点一下