主函數(shù): mInitCH376Host(); // 設(shè)置為HOST模式 if(init_print()==0x14) // 初始化USB打印機(jī) printf("打印機(jī)初始化成功!");delay_ms(50); send_data(1,printdata); printf("程序執(zhí)行完畢!");
程序我是參考CH375 HOST的例程。 從串口得到的 設(shè)備描述符等: 通信測試正常! USB模式設(shè)置完成!模式5 USB模式設(shè)置完成!模式7 USB模式設(shè)置完成!設(shè)備已連接!模式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
打印機(jī)初始化成功! endp_in_addr:0x3 endp_out_addr:0x2 endp_out_size:0x40 成功發(fā)送!程序執(zhí)行完畢!
我用BUS Hound直接發(fā)送ASCII數(shù)據(jù)就可以打印,用CH376這樣可以嗎?