将CH376通过并口连接89c52RC单片机以后,参照本论坛"376操作鼠标键盘"将TH1改为0XF3以后得到打印结果 程序为 void main( void ) { UINT8 i,s; mDelay50mS( ); //CH376上电之后需要延时40ms左右 StdioInit( ); printf("start \n");
//做测试命令,检测单片机和CH376硬件连接,以及读写时序是否正确 CH376_WR_CMD_PORT( 0x06 );
CH376_WR_DAT_PORT( 0x55 );
s = CH376_RD_DAT_PORT( );
printf(" %02x \n",(UINT16)s);
Set_USB_Mode( 5 ); //设置USB主机模式, 如果设备端是CH37X, 那么5和6均可
set_freq( ); //使376进入低速模式 while(1) { printf(" \n wait usb device : \n"); while ( wait_interrupt()!=USB_INT_CONNECT ); mDelaymS(50); Reset_Device(); //复位usb设备 mDelaymS(50); set_freq( ); //使376进入低速模式 mDelaymS(20);
//获取设备描述符 if(Get_Dev_Descr()==1) { for(i=0;i!=data_buf[0];i++) printf("%02x ",(unsigned int)data_buf[i]); printf("\n"); } else printf("\n get device descr failed \n"); 开始以为鼠标电压不够,后来加电压出现一样的情况,仍然出现以下情况 start aa wait usb device :
get device descr failed cfg 14
set idle error report error 00 都想了好久了,不知道原因何在