You must declare it in USBdsc.c by the code const char USB_TRANSFER_TYPE = 0x03 //0x03 is for interruptĪttach the USBDsc.c file to your project. From your code, you are using the interrupt method. If your device is self-powered then replace it with const char USB_SELF_POWER = 0xC0 //When it is self poweredĪn HID device can operate in two modes, interrupt or polling. You must declare it in file USBdsc.c: const char USB_SELF_POWER = 0x80 //When it is bus powered I don't know whether your device is bus-powered or self-powered. Disable the USB voltage regulator, and then make a trial. I was in problem for a long period only for this issue. Otherwise the PC can not detect it as a high-speed device.Īnother important thing is to add a capacitor (10 µf or something like this, electrolytic) to the VUSB pin which is pin number 14 of PIC18F2550. You must insert a 1 kohm resistor between D+ and VCC. But there are another things to consider. I have made a data acquisition device using PIC18F2550 using MikroC PRO. I just can't figure out what's wrong with my code. PS.: To make sure the microcontroller is working fine, I loaded a sample hex file for a USB HID mouse onto the microcontroller, and it was working. But I still can't make it work with the MikroC PRO. I've tried the older version on MikroC, that is, version 8.2, and I got it working (the HID device gets detected.). Unsigned char writebuff absolute 0x540 Īlso included in the project is the file USBdesc.c which can be generated inside the HID terminal of MikroC. I'm making a USB HID device using PIC18F2550 using 20 MHz crystal input and using the MikroC PRO C compiler for PIC.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |