这是个串口通信中的子过程,但是功能不明。procedure GetData(portn: integer; str: pchar);//portn: COM号 
var
  rec_temp:byte;
  time_start,time_end:TDateTime;
begin
    time_start:=now;
    repeat  rec_temp:=sio_iqueue(portn);//
    time_end:=now;
    if time_end-time_start>0.0000057 then//这个地方不理解
    begin
      application.MessageBox(str,'出错提示框',0);
      beep();
      exit;
    end;
    until rec_temp>0;
end;

解决方案 »

  1.   

    在delphi里面,tdatetime就是tdouble
    1就表示1天,所以0.0000057表示0.0000057×24×3600秒约为0.5秒
      

  2.   

    那么这个过程实现了什么功能呢?
    在0.5s内没有数据过来就报错?until rec_temp>0;这个地方实现什么功能 
      

  3.   

    不知道你的sio_iqueue函数的功能
    貌似应该是接收数据,一有数据,应该rec_temp会大于0,循环终止,如果0.5秒没有收到数据就报错