#include <18F67J10.h>
#device adc=8
#FUSES NOWDT, WDT128, HS, NODEBUG, NOXINST, STVREN, NOPROTECT, FCMEN, IESO, PRIMARY, RESERVED
#use delay(clock=20000000)

#include "G:\Borrar\main_bootloader.h"
//BOOTLOADER AT START - Include Bootloader.h in your application - See sample application Ex_Bootload.c  
//BOOTLOADER AT END - Always include the projectname_bootloader.h file in future versions of the project

// NOTE - User must include PROJECTNAME_bootloader.C in his final Application program

void application(void) {
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF|ADC_TAD_MUL_0);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_spi2(SPI_SS_DISABLED)
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_timer_4(T4_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);

   // TODO: USER CODE!!
}


void main()
{// Enter Bootloader if Pin B5 is low after a RESET
   if(!input(PIN_B5))
   {
      real_load_program();
   }
      application();
}
