User`s manual

206 digi.com Keywords
interrupt_vector
This keyword, intended for use with separate I&D space, sets up an interrupt vector at compile time. This
is its syntax:
interrupt_vector <INT_VECTOR_NAME> <ISR_NAME>
Interrupt vector names and ISR names are found in Table 11-5 on page 191. The following code fragment
illustrates how interrupt_vector is used.
// Set up an Interrupt Service Routine for Timer B
#asm
timerb_isr::
; ISR code
...
ret
#endasm
main() {
// Variables
...
// Set up ISR
interrupt_vector timerb_intvec timerb_isr; // Compile time setup
// Code
...
}
interrupt_vector overrides run time setup. For run time setup, you would replace the
interrupt_vector statement above with:
#rcodorg <INT_VEC_NAME> apply
#asm
INTVEC_RELAY_SETUP(timerb_intvec + TIMERB_OFS)
#endasm
#rcodorg rootcode resume
This results in a slower interrupt (80 clock cycles are added), but an interrupt vector that can be modified
at run time. Interrupt vectors that are set up using interrupt_vector are fast, but can’t be modified
at run time since they are set at compile time.
If you are using Dynamic C 9.30 or later, the _RK_FIXED_VECTORS macro must be used to condition-
ally compile code containing the interrupt_vector keyword. For Rabbit 3000A and later CPUs,
Dynamic C makes use of the new RAMSR capability to make in-RAM interrupt table access fast. The fol-
lowing code demonstrates the correct way to use _RK_FIXED_VECTORS so as to eliminate errors
regarding undefined interrupt vectors.