完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好!我尝试通过使用HID库通过USB连接PIC18F45 K50到PC。在PC上,我有一个使用Atmel HID库的应用程序,我确信它工作正常。我第一次使用微芯片HID库。所以我做了一个基于HiDuFug示例的项目。这是我的代码:所以我的PC找到了控制器来设置连接。问题是我不能向控制器传送任何东西。HIDRxHandleBusy(U***thdle)总是正确的。还有什么事要我做吗?有特殊的结束符号吗?在PC上,我用1作为结束符号。谢谢!
以上来自于百度翻译 以下为原文 Hi! I`m trying to connect PIC18F45K50 to PC through USB using HID library. On the PC I have an app using atmel HID library and I`m sure it`s working correctly. I`m using microchip HID library for a very first time. So I made a project based on hid_custom example. Here is my code : //code init SYSTEM_Initialize(SYSTEM_STATE_USB_START); USBDeviceInit(); USBDeviceAttach(); APP_DeviceCustomHIDInitialize(); //main loop SYSTEM_Tasks(); APP_DeviceCustomHIDTasks(); //my app device function void APP_DeviceCustomHIDTasks() { /* If the USB device isn't configured yet, we can't really do anything * else since we don't have a host to talk to. So jump back to the * top of the while loop. */ if( USBGetDeviceState() < CONFIGURED_STATE ) { return; } /* If we are currently suspended, then we need to see if we need to * issue a remote wakeup. In either case, we shouldn't process any * keyboard commands since we aren't currently communicating to the host * thus just continue back to the start of the while loop. */ if( USBIsDeviceSuspended()== true ) { return; } //Check if we have received an OUT data packet from the host if(HIDRxHandleBusy(USBOutHandle) == false) { //We just received a packet of data from the USB host. //Check the first uint8_t of the packet to see what command the host //application software wants us to fulfill. if(!HIDTxHandleBusy(USBInHandle)) { USBInHandle = HIDTxPacket(CUSTOM_DEVICE_HID_EP, (uint8_t*)&ToSendDataBuffer[0],64); } //Re-ARM the OUT endpoint, so we can receive the next OUT data packet //that the host may try to send us. USBOutHandle = HIDRxPacket(CUSTOM_DEVICE_HID_EP, (uint8_t*)&ReceivedDataBuffer[0], 64); } } So my PC finds the controller I menage to set connection. The problem is I can`t transmit anything to the controller. HIDRxHandleBusy(USBOutHandle) is always TRUE. Is there anything else I have to do? Is there a special end symbol? On the PC I`m using 1 as end symbol. Thanks! |
|
相关推荐
3个回答
|
|
您可能需要与另一个应用程序交叉检查。对于自定义的HID示例,我编写了一个在Windows上使用的方法,您可以下载EXE和DLL。然后解压缩所有的内容,并用DLL将EXE粘贴到文件夹中……对于Linux,您必须下载源代码。用QT构建它。
以上来自于百度翻译 以下为原文 You possibly should cross check this with another application. For the custom HID example I wrote one that is found here For use on Windows you can download the EXE and the DLLs. Then you unzip everything and paste the EXE into the folder with the DLLs... For Linux you have to download the sources and build it with Qt. |
|
|
|
我尝试了几次不同的应用程序-没有效果。这个设备是从PC中正确找到的,我可以连接到它,但是我不能发送或接收数据……有什么想法吗?我有一个工作的疾病预防控制中心的计划,我打算测试它明天只是为了确保我的硬件是好的!
以上来自于百度翻译 以下为原文 I tried several times with different apps - no effect. The device is correctly found from the PC and I can connect to it, but I can`t transmit or receive data... Any ideas? I have a working CDC program and I`m going to test it tomorrow just to be sure my hardware is ok! |
|
|
|
你选择了哪一个开始的例子?这一个?&…………ML/V2016- 111107/Apps/UBS/Debug /固件/ PICDEMYFSUSBYK50.X
以上来自于百度翻译 以下为原文 Which example did you choose for starting? This one ? -> ...mla/v2016_11_07/apps/u***/device/hid_custom/firmware/picdem_fs_u***_k50.x |
|
|
|
只有小组成员才能发言,加入小组>>
5238 浏览 9 评论
2028 浏览 8 评论
1950 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3204 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2253 浏览 5 评论
777浏览 1评论
666浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
595浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
676浏览 0评论
576浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 01:12 , Processed in 1.285479 second(s), Total 84, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号