asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Wed Oct 19, 2005 10:24 am |
|
|
Here is some early code I used when I was migrating from assembler to CCS C and need to retian my assembler interrupt hanlders because I used multiple high priority interrupts on the PIC18F which were not supported by CCS at the time.
I fooled the compiler into thinking the interrupt vectors were located elsewhere then I put the real vectors in place. The compiler did not optimise out this code.
Code: |
// prevent the compiler sticking code between 0x0004 and 0x0007
#build(reset=0x00:0x07)
// fool the compiler to allow access to the real high and low priority vectors
#build(interrupt=0x028)
#org 0x0020, 0x002f {}
/* Map the high priority interrupt vector */
#org 0x0008, 0x000f
void my_hp_intr (void)
{
#asm
goto 0x0100
#endasm
}
/* Map the low priority interrupt vector */
#org 0x0018, 0x001f
void my_lp_intr (void)
{
#asm
goto 0x0200
#endasm
}
#org 0x0100, 0x01ff
void HPIntrHdlr(void) {
#asm ASIS
.... |
_________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|