求助串口读CH376

if (InitCH376Host() == USB_INT_SUCCESS) { if (CH376DiskConnect()== USB_INT_SUCCESS) { while(1); } else { if(CH376DiskMount() != USB_INT_SUCCESS) { Dlayms(100); while(1); } else { strcpy(buf, "\ABC.TXT"); if(CH376FileOpen(buf)==USB_INT_SUCCESS) { CH376ByteRead( buf, 30, &RealCount ); } } } } 前面都正常,运行 CH376ByteRead( buf, 30, &RealCount );时,s = Wait376Interrupt( );s=0x14,不是USB_INT_DISK_READ ,一直进不去,不知什么原因。下面是CH376ByteRead函数。

UINT8 CH376ByteRead( PUINT8 buf, UINT16 ReqCount, PUINT16 RealCount ) /* 以字节为单位从当前位置读取数据块 */ { UINT8 s; WriteCH376Cmd(CMD2H_BYTE_READ); WriteCH376Data((UINT8)ReqCount); WriteCH376Data((UINT8)(ReqCount>>8)); if (RealCount) { *RealCount = 0; } while ( 1 ) { s = Wait376Interrupt( ); if ( s == USB_INT_DISK_READ ) { s = CH376ReadBlock( buf ); // 从当前主机端点的接收缓冲区读取数据块,返回长度 WriteCH376Cmd( CMD0H_BYTE_RD_GO ); buf += s; if ( RealCount ) { *RealCount += s; } } else { return( s ); /* 错误 */ } } }

此问题的回复,请查看站内贴:

http://www.wch.cn/bbs/index.php?s=/index-thread-id-61616-p-1.html


只有登录才能回复,可以选择微信账号登录