The PIC24FJ64GB002 board equipped with a USB bootloader
<< Pin connection of my USB board >>
Bootloader ( RB0 – LED, RB1 – LED, RB2 – switch2 (pull down), MCLR – switch1 (pull down) )
LCD : SC1602BBWB-XA-GB-G ( RS – RB7, R/W – GND, E – RB8, Data bus: DB4 – RB9, DB5 – RB13, DB6 – RB14, DB7 – RB15, VDD – 5 volt )
<< Clock of my USB board >>
FRC 8 MHz – 96 MHz PLL;
48 MHz for USB Module (96 MHz PLL divide by 2);
32 MHz for System Clock (96 MHz PLL divide by 3);
_CONFIG2( POSCMOD_NONE & I2C1SEL_PRI & IOL1WAY_OFF & OSCIOFNC_ON & FCKSM_CSDCMD & FNOSC_FRCPLL & PLL96MHZ_ON & PLLDIV_DIV2 & IESO_OFF )
CLKDIV = 0b0000000000100000;
<< USB Bootloader code >>
When you compile this project by XC16 in MPLAB X, you must include the linker provided for HID Bootloader by Microchip Technology.
<< LCD display code >>
A code for a USB bootloader must be compiled at the code offset, 0x1400, with the linker provided by Microchip Technology .
<< Reference >>
USB framework : microchip-application-libraries-v2013-02-15 , Device – Bootloaders for HID