asdyj
06-25 20:17
procedure Set_PC_Control;
begin
outp(Port_ID+2,$F1);
end;
procedure Clear_PC_Control;
begin
outp(Port_ID+2,$f0);
end;
procedure Set_Port_Data(D:Byte);
begin
outp(Port_ID,D)
end;
function Line_Free(var R:Byte):Boolean;
var B:integer;
begin //查询ERROR位为高、表示单片机已经释放线路
B:=inp(Port_ID+1);
R:= Lo(B) xor $80;
Result:=B and $08>0
end;
procedure Reset_Tester; stdcall
begin
outp(Port_ID+2,$fC);
Delay_US(5000);
outp(Port_ID+2,$f4);
Delay_US(5000);
end;
procedure Set_ID(ID:byte); stdcall
//var B:byte;
begin
outp(Port_ID+2,$f0); //AUTO_FEED = 0
outp(Port_ID,ID);
Delay_US(50000);
outp(Port_ID+2,$f2); //AUTO_FEED = 1
//CVI_outp(Port_ID+2,$0C); //INIT = 1
Delay_US(50000);
outp(Port_ID+2,$f0);
{
repeat
B:=CVI_inpd(Port_ID+2)
until B and $F= $0; //AUTO_FEED = 0
}
//CVI_outpd(Port_ID+2,$00); //INIT = 0
end;
执行数据和状态端口读写后,调用Set_ID就出问题,哪怕软件处于调试状态,控制口的状态都会自动跳变!电脑开机大约30分钟后,问题消失。