1.3.5 Bootloader:Application Generation Procedure
To create the application, a new project for this same part will be created named PIC24FJ128GA204_BootloaderApplication. Once created, add the 16-Bit Bootloader:Application library to the project.
Select Device Resources->Libraries->16-bit Bootloader->16-bit Bootloader:Application.
The help information for this screen is found at Application Builder 16-bit Bootloader:Bootloader->User Interface->Application.
The application build screen is shown below. There is only one item to fill in from this screen, the location of the original bootloader project. Traverse back to the root of the bootloader project. The build tool for the application builder will then read the configuration of the original bootloader project and copy everything over and setup up the application interrupts to match what was configured in the bootloader.
If any configuration bits are different here, a notification warning displaying the difference will be asserted. The reason for this is to make sure the application configuration matches what the bootloader has in terms of the configuration bits. This is described in the help file Application Builder 16-bit Bootloader:Bootloader->User Interface->Application Builder
To use the same LED1 (RA9) as a blinking LED heartbeat light, configure RA9 (LED1) as an output for the LED was done earlier. For the interrupt source, use MCC to enable Timer1 for a 250 ms Interrupt and have the Timer1 Callback ISR (TMR1_Callback()) toggle LED1. The function TMR1_CallBack(void) will be placed at the top of the application main.c file as shown below.
#include "mcc_generated_files/system.h" #include "mcc_generated_files/pin_manager.h" void TMR1_CallBack(void) { LED1_Toggle(); }
At this point the application in standalone can be built and run without the bootloader, just as one would normally would without a bootloader. LED1 will be blinking at a different rate than the bootloader and will visually show the user they are in the application code. (About 250ms).