PIC Interrupts - C18 compatibility mode



I'd appreciate some advice on PIC interrupts under M'chip C18. Just
working on converting some PIC 18F252 C code for use with Microchip
C18, which is new to me, C18 is a good deal more complex than the C
compiler I've used to date, which hid the detailed vectoring -
interrupt setup is a bit trickier... I want to leave the device in
basic 16X compatibility mode as used before, don't need priorities,
only one ISR involved. I understand that I have to get the priority
right as far as the compiler is concerned so that either hardware or
s/w stacks are used for the context save. I'm not sure I've got this
right for compatibility mode as in this case the vector for all
interrupts is 0x08, the high priority vector in 18F priority mode.

I *think* that the only way the compiler decides how to context save
during the ISR is the line #pragma interruptlow (or interrupt) just
before the ISR function itself, hope this is correct?

Anyway, can someone kindly advise if the code below will work to set
up one ISR with C18.

Steve

Code:

/* Interrupt vector setup */

#pragma code low_vector=0x08 //All interrupts at this address

void interrupt_low(void)
{
_asm
goto Interrupt_main
_endasm
}
#pragma code //Returns to previous code section


//and later.....


#pragma interruptlow Interrupt_main
void Interrupt_main(void)
{
if (PIR1 & 0x01) /* Timer 1 interrupt */
.
.
}
.



Relevant Pages

  • Re: Linux serial port dropping bytes
    ... Changing ISR priority isn't going to make any difference. ... It only determines which of two pending interrupts get ... preempt lower priority ones. ...
    (comp.arch.embedded)
  • Re: Linux serial port dropping bytes
    ... doesn't normally have a preemptible kernel (I've turned on the ... Changing ISR priority isn't going to make any difference. ... It only determines which of two pending interrupts get ...
    (comp.arch.embedded)
  • Re: Linux serial port dropping bytes
    ... Changing ISR priority isn't going to make any difference. ... It only determines which of two pending interrupts get ... context). ...
    (comp.arch.embedded)
  • Re: How to change interrupt priority
    ... Although the ISR really doesn't do much other than 'sums' ... > and service our hardware, there are a lot of calcs and time spent in the ... > for lower priority interrupts to wait for us. ...
    (microsoft.public.windowsce.platbuilder)
  • Re: PIC Interrupts - C18 compatibility mode
    ... C18, which is new to me, C18 is a good deal more complex than the C ... interrupt setup is a bit trickier... ... only one ISR involved. ... the high priority vector in 18F priority mode. ...
    (sci.electronics.design)