i made a HID bootloader.
it programs itself but the problem is that i can not make it to do any work.
when i read and export the hex file there is nothing in that.
now i want a code example and a hex file just to blink a led.
#define REMAPPED_RESET_VECTOR_ADDRESS 0x0800
#define REMAPPED_HIGH_INTERRUPT_VECTOR_ADDRESS 0x0808
#define REMAPPED_LOW_INTERRUPT_VECTOR_ADDRESS 0x0818
extern void _startup (void); // See c018i.c in your C18 compiler dir
#pragma code REMAPPED_RESET_VECTOR = REMAPPED_RESET_VECTOR_ADDRESS
void _reset (void)
{
_asm goto _startup _endasm
}
#pragma config PLLDIV = 5
#pragma config CPUDIV = OSC1_PLL2
#pragma config USBDIV = 2
#pragma config FOSC = HSPLL_HS //Internal oscillator, port function on RA6, EC used by USB
#pragma config WDT = OFF //Disable watchdog timer
#pragma config PWRT = OFF
#pragma config BOR = ON_ACTIVE
#pragma config BORV = 3
#pragma config VREGEN = ON //Internal oscillator, port function on RA6, EC used by USB
#define LEDPin LATDbits.LATD1 //Define LEDPin as PORT D Pin 1
#define LEDTris TRISDbits.TRISD1 //Define LEDTris as TRISD Pin 1
#define LEDPin2 LATDbits.LATD2 //Define LEDPin as PORT D Pin 1
#define LEDTris2 TRISDbits.TRISD2 //Define LEDTris as TRISD Pin 1
void main()
{
LEDTris = 0;//Set LED Pin data direction to OUTPUT
LEDPin = 1;//Set LED Pin
LEDTris2 = 0;//Set LED Pin data direction to OUTPUT
LEDPin2 = 0;//Set LED Pin
while(1)
{
LEDPin = ~LEDPin;//Toggle LED Pin
LEDPin2 = ~LEDPin2;//Toggle LED Pin
Delay10KTCYx(100);//Delay 250K cycles (1 second at 1MHz since each instruction takes 4 cycles)
}
}
thanks for your reply
---------- Post added at 12:53 ---------- Previous post was at 12:49 ----------
will my circuit start working after i press reset button in the hid bootloader ?
I presume you are using Hitech C, here is an example how to do it in CCS:
#define CODE_START 0x0800
#build(reset=CODE_START, interrupt=CODE_START+0x08)
#org 0, CODE_START-1 {}
Thanks for your reply.
now i can read the hex.
i am using MPLAB C18.
can anyone send me a source code and hex file for the HID bootloader just to blink an LED.
it'll be much more helpful.
and another thing if i burn the code into the pic and reset the pic will start working ???
do i have to add separate power supply?
can you please send me a hex and source code file that you have tested in your system.
it'll be better if your code is in mplab_c18.
it'll be better if your code only blinks 2 leds on pin 20 and 21.
check on microchip web page in Bootloader,download code source and check where start your program like a 0 x 1000,after don't forget to put in your main where program need to start,very easy.
to blink led,do your own code,(a few lines)if you cannot do this,why you need a bootloader?
check this
**broken link removed**
And
**broken link removed**
also
check your config fuse,you need to put same in your main prog