在我的计算机程序与CH372设备通信时(通过51单片机),经常出现找不到USB设备的情况,而此时查看Windows系统的USB设备时,该设备确实存在,并且状态正常.问题出在哪里?请教板主和各位高手. 以下是我的上位机打开USB设备的函数: function TCh375USB.Open():Boolean; var handle : cardinal; i:Byte; begin //打开USB Result:=False; DeviceNumber:=0; for i:=0 to 15 do begin if CH375OpenDevice(i)=$FFFFFFFF then Continue; handle:=CH375GetUsbID(i);//高16位为产品PID,低16位为厂商VID if (handle>0) and (HiWord(handle)=$0123) and (LoWord(handle)=$1234) then begin DeviceNumber:=i; CH375SetBufUpload(DeviceNumber,1); //CH375ResetRead(DeviceNumber); CH375SetTimeout(DeviceNumber, 3000, 3000); CH375SetExclusive(DeviceNumber,0); //设为独占方式 CH375SetDeviceNotify(DeviceNumber,'',NotifyRoutine); // CH375SetIntRoutine(DeviceNumber,IntRoutine); Result:=True; FActive:=true; Break; end; end; if not FActive then Exit; end;