主函数: mInitCH376Host(); // 设置为HOST模式 if(init_print()==0x14) // 初始化USB打印机 printf("打印机初始化成功!");delay_ms(50); send_data(1,printdata); printf("程序执行完毕!");
程序我是参考CH375 HOST的例程。 从串口得到的 设备描述符等: 通信测试正常! USB模式设置完成!模式5 USB模式设置完成!模式7 USB模式设置完成!设备已连接!模式6 init_print() >> p_dev_descr->bLength:0x12 init_print() >> p_dev_descr->bDescriptorType:0x1 init_print() >> p_dev_descr->bcdUSB:0x200 init_print() >> p_dev_descr->bDeviceClass:0x7 init_print() >> p_dev_descr->bDeviceSubClass:0x0 init_print() >> p_dev_descr->bDeviceProtocol:0x0 init_print() >> p_dev_descr->bMaxPacketSize0:0x10 init_print() >> p_dev_descr->idVendor:0x471 init_print() >> p_dev_descr->idProduct:0x2379 init_print() >> p_dev_descr->bcdDevice:0x100 init_print() >> p_dev_descr->iManufacturer:0x1 init_print() >> p_dev_descr->iProduct:0x2 init_print() >> p_dev_descr->iSerialNumber:0x0 init_print() >> p_dev_descr->bNumConfigurations:0x1
-------------- init_print() >> p_cfg_descr->bLength:0x9 init_print() >> p_cfg_descr->bDescriptorType:0x2 init_print() >> p_cfg_descr->wTotalLength:0x20 init_print() >> p_cfg_descr->bNumInterfaces:0x1 init_print() >> p_cfg_descr->bConfigurationValue:0x1 init_print() >> p_cfg_descr->iConfiguration:0x0 init_print() >> p_cfg_descr->bmAttributes:0xc0 init_print() >> p_cfg_descr->MaxPower:0x32
-------------------------- init_print() >> p_itf_descr->bLength:0x9 init_print() >> p_itf_descr->bDescriptorType:0x4 init_print() >> p_itf_descr->bInterfaceNumber:0x0 init_print() >> p_itf_descr->bAlternateSetting:0x0 init_print() >> p_itf_descr->bNumEndpoints:0x2 init_print() >> p_itf_descr->bInterfaceClass:0x7 init_print() >> p_itf_descr->bInterfaceSubClass:0x1 init_print() >> p_itf_descr->bInterfaceProtocol:0x2 init_print() >> p_itf_descr->iInterface:0x0
-------------- init_print() >> endp_descr-> init_print() >> endp_descr->bDescriptorType:0x5 init_print() >> endp_descr->bEndpointAddress:0x2 init_print() >> endp_descr->bmAttributes:0x2 init_print() >> endp_descr->wMaxPacketSize:0x40 init_print() >> endp_descr->wMaxPacketSize1:0x0 init_print() >> endp_descr->bInterval:0x0
-------------------------- init_print() >> endp_descr->bLength:0x7 init_print() >> endp_descr->bDescriptorType:0x5 init_print() >> endp_descr->bEndpointAddress:0x83 init_print() >> endp_descr->bmAttributes:0x2 init_print() >> endp_descr->wMaxPacketSize:0x40 init_print() >> endp_descr->wMaxPacketSize1:0x0 init_print() >> endp_descr->bInterval:0x0
-------------------------- init_print() >> endp_descr-> init_print() >> endp_descr->bDescriptorType:0x0 init_print() >> endp_descr->bEndpointAddress:0x0 init_print() >> endp_descr->bmAttributes:0x0 init_print() >> endp_descr->wMaxPacketSize:0x0 init_print() >> endp_descr->wMaxPacketSize1:0x0 init_print() >> endp_descr->bInterval:0x0
-------------------------- init_print() >> endp_descr->bLength:0x0 init_print() >> endp_descr->bDescriptorType:0x0 init_print() >> endp_descr->bEndpointAddress:0x0 init_print() >> endp_descr->bmAttributes:0x0 init_print() >> endp_descr->wMaxPacketSize:0x0 init_print() >> endp_descr->wMaxPacketSize1:0x0 init_print() >> endp_descr->bInterval:0x0
打印机初始化成功! endp_in_addr:0x3 endp_out_addr:0x2 endp_out_size:0x40 成功发送!程序执行完毕!
我用BUS Hound直接发送ASCII数据就可以打印,用CH376这样可以吗?