procedure TForm1.Comm1ReceiveData(Sender: TObject; Buffer: Pointer;
BufferLength: Word);
var subf:array[1..5000] of byte;
i:integer;
begin
i:=1;
move(buffer^,pchar(@subf)^,bufferlength);
while i<=bufferlength do
begin
if subf=254 then
begin
Series2.AddXY(series2.XValues.Last+0.03,subf[i+1]);
series1.AddXY(series1.XValues.Last+0.03,subf[i+2]);
memo1.Lines.Add(inttohex(subf[i+1]));
inc(i,3)
end;
end;
end;
这里应该没有问题吧,如果是硬件问题,会是单片机的吗?但用串口小助手能够正常接收到数据...