@天道玄虚 因为我的数据是串口发送来的,帧头是f5和ob,发送500次后,就会在传输的数据后还有两个数据,最后两个提取出来。要是使用赋值会不会数据量太大,刚才加上您说的line.clear语句后,还是会周期性的出现245(帧头f5的十进制)和11(帧头0b的十进制),一直纳闷为什么会出现这个?
for i:=b to a do
begin
if (indata[i] =$f5) and (indata[i+1]=$0b) then
begin
y1:= indata[i+2]*256+indata[i
+3
];
y2:= indata[i+4];
y3:= indata[i+5];
y11:=FormatFloat('00.0000',y1);
y22:=FormatFloat('00.0000',y2);
y33:=FormatFloat('00.0000',y3);
if TryStrToFloat(y11,c1) then
begin
iplot1.Channel[0].AddXY(j/h,c1);
end;
inc(j);
Memo2.Lines.Clear;
Memo2.Lines.Add(y22);
Memo3.Lines.Clear;
Memo3.Lines.Add(y33);
end;
end;
inc(i);
end;