You are here

Functioning

Bootloader is a program for PIC18F4455. It can be used with other microcontrollers, if they have USB interface compatible with PIC18F4455. The necessary changes are described in Chapter 5. Setup and configuration.

Bootloader allows you to burn other programs into the microcontroller flash memory and run them.

Bootloader is located in the lower 2048 bytes of PIC microcontroller Flash memory and uses its reset and interrupt vectors. This imposes some limitations on the user application, and requires additional changes in the source code.

To work with Bootloader, user mode application must be linked using a special command file for MPLINK. The necessary linker command files can be found in the bootloader installation package.

The user mode program should begin with the address 0x0800, because the zero address is occupied by the bootloader. Bootloader automatically passes control to the address 0x0800 to start the user mode program.

If the user mode application uses interrupts, the interrupt vectors also must be redefined:

  • high priority interrupts vector must be located at address 0x0808;
  • low priority interrupts vector must be located at address 0x0818.

Example for MCC18:

#pragma code high_vector=0x0808
void interrupt_at_high_vector(void)
{
}
#pragma code low_vector=0x0818
void interrupt_at_low_vector(void)
{
}
Example for MPASM: 
 ORG 0x0808
interrupt_at_high_vector
 goto high_int_handler
 ORG 0x0818
interrupt_at_low_vector
 goto low_int_handler