You can skip this chapter if you use a PIC USB Demo Board as the microprocessor for this demonstration board already has compiled and programmed bootloader.
You would need a chip writer to program the Bootloader into the target microcontroller. There are many different chip writers for PIC18F. This manual describes the using of Microchip ICD2 programmer.
After a successful compilation you can program the bootloader into the target microcontroller. Make sure that ICD2 drivers are installed, and it is connected to the PC.
Verify that the ICD2 is not used as a debugger. To do this select "None" in the "Debug->Select" menu, and select "ICD2" in the "Programmer->Select" menu. You will see a ICD2 programmer toolbar.
Open the ICD2 programmer properties window using the "Programmer->Settings" menu. If ICD2 is connected to the USB port of your PC, select "USB" at the "Interface" tab. If you connected ICD2 to COM port, choose the appropriate COM port and speed. Click "OK" button to close the dialog.
Connect ICD2 to the target microcontroller. Click "Connect ICD2" button. If ICD2 is correctly connected to the target microcontroller, you will see the microcontroller type and revision number in MPLAB messages window. Verify that the information corresponds to the selected microcontroller in MPLAB configuration settings.
In case of errors, make sure that the ICD2 is connected to a USB port, ICD2 driver installed, ICD2 is connected to target microcontroller, connection cords are in good order, and power is supplied to both ICD2 and microcontroller.
Click the "Program" button on the ICD2 toolbar. Wait for programming completion and disconnect the target microcontroller from ICD2.