If it compiles ... The number one cause of USB failure, is improper Oscillator Configurations.
For 4Mhz Crystal ...
Code:
@ __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
For 8Mhz Crystal ...
Code:
@ __CONFIG _CONFIG1L, _PLLDIV_2_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
For 20Mhz Crystal ...
Code:
@ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
For any of the above configurations, use ...Number two reason ... improper capacitance on VUSB pin. (0.22uF or higher)
#3, connecting +5V from USB port to +5V supply from powered project. (very bad)
Ok, that's not really #3, but it is bad. 
Bookmarks