Hi
Can you please let me know how the bootloader handles interrupts in run mode.
The interrupt vectors are at 0x08 & 0x18. Are these redirected to memory above 0x0800, is so where?
I've tried 0x0818 (which strikes me as the obvious) but to no avail.
I'm using the MPLAB IDE / MPLAB C and can get code successfully running on the formula flowcode buggy, but have had no success with the interrupts.
Additionally, are you able to give any informations (or point me at any) as to what exactly is in the bootloader.
Thanks
Mal
Bootloader and Interrupts
Moderator: Benj
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: Bootloader and Interrupts
The 3 vectors (reset, hight interrupt and low interrupt) are remapped as follows:
I've just tried a quick timer interrupt test program in Flowcode (attached to this message) and it worked fine - I've also attached the C and Assembly.
The bootloader is run whenever the chip is reset or powered. It does a quick check to see if the USB cable is plugged in. If it is not, or if either of the switches (B4 and B5) are held down, it will run the user's own program. If the USB cable is in and these switches are not held down, then it will enter the bootloader mode, turn the USB on and the device can be reprogrammed.
Code: Select all
RESET_VECTOR = 0x000800
HIGH_INTERRUPT_VECTOR = 0x000808
LOW_INTERRUPT_VECTOR = 0x000818
The bootloader is run whenever the chip is reset or powered. It does a quick check to see if the USB cable is plugged in. If it is not, or if either of the switches (B4 and B5) are held down, it will run the user's own program. If the USB cable is in and these switches are not held down, then it will enter the bootloader mode, turn the USB on and the device can be reprogrammed.
- Attachments
-
- buggy int test.asm
- (12.09 KiB) Downloaded 408 times
-
- buggy int test.c
- (2.35 KiB) Downloaded 476 times
-
- buggy int test.fcf
- (4 KiB) Downloaded 445 times
Re: Bootloader and Interrupts
Steve
Most useful. Many thanks.
For info for anyone else struggling with this, as it turned out I had remapped the interrupt ok but I had not redirected the reset vector to 'Main' which meant the code was not executing! This was not a problem when I was not using the interrupts as the executable started at 0x0800, but with the interrupt vectors in use it has to start at 0x082a. I needed to add in :
#pragma code reset_vector=0x0800
void _reset (void)
{
_asm GOTO main _endasm
}
with the main code located at 0x082a to overcome this.
Regards
Mal
Most useful. Many thanks.
For info for anyone else struggling with this, as it turned out I had remapped the interrupt ok but I had not redirected the reset vector to 'Main' which meant the code was not executing! This was not a problem when I was not using the interrupts as the executable started at 0x0800, but with the interrupt vectors in use it has to start at 0x082a. I needed to add in :
#pragma code reset_vector=0x0800
void _reset (void)
{
_asm GOTO main _endasm
}
with the main code located at 0x082a to overcome this.
Regards
Mal