在我的計(jì)算機(jī)程序與CH372設(shè)備通信時(shí)(通過(guò)51單片機(jī)),經(jīng)常出現(xiàn)找不到USB設(shè)備的情況,而此時(shí)查看Windows系統(tǒng)的USB設(shè)備時(shí),該設(shè)備確實(shí)存在,并且狀態(tài)正常.問(wèn)題出在哪里?請(qǐng)教板主和各位高手. 以下是我的上位機(jī)打開(kāi)USB設(shè)備的函數(shù): function TCh375USB.Open():Boolean; var handle : cardinal; i:Byte; begin //打開(kāi)USB Result:=False; DeviceNumber:=0; for i:=0 to 15 do begin if CH375OpenDevice(i)=$FFFFFFFF then Continue; handle:=CH375GetUsbID(i);//高16位為產(chǎn)品PID,低16位為廠(chǎng)商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); //設(shè)為獨(dú)占方式 CH375SetDeviceNotify(DeviceNumber,'',NotifyRoutine); // CH375SetIntRoutine(DeviceNumber,IntRoutine); Result:=True; FActive:=true; Break; end; end; if not FActive then Exit; end;