如果你有两个串口,可以一个用来发,一个用来收
如果你有两台电脑,可以用串口线连起来,一台发,一台收
如果用MScomm
//·¢ËÍ
var
buffer_send:Variant;
begin
buffer_send:=VarArrayCreate([0,4], varbyte);
buffer_send[0]:=78;
buffer_send[1]:=56;
buffer_send[2]:=34;
buffer_send[3]:=12;
buffer_send[4]:=4;
mscomm1.output:=buffer_send;
end;
//½ÓÊÜ,Ê×ÏÈÊôÐÔInputModeÉèÖóÉcomInputModebinary.
procedure TForm1.MSComm1Comm(Sender: TObject);
var
buffer_receive:Variant;
b:array of byte;
i:integer;
begin
buffer_receive:=mscomm1.input;
setlength(b,MSComm1.InBufferCount);
for i:=low(b) to high(b) do b:=buffer_receive;
end;