Hardware Reference
In-Depth Information
After writing the interrupt service routine, the user also needs to set up the interrupt vec-
tor. The template for setting up the interrupt vector table is given in Appendix G. There are two
parts in setting up the interrupt vector.
Part 1. Declare the interrupt service routine to be external.
Part 2. Insert the name of the interrupt service routine into the appropriate place of the
interrupt-vector table.
For example, the RTI interrupt vector can be set up as follows assuming that the name of
its service routine is rtiISR:
extern void near rtiISR (void); // rtiISR is defined outside this file
#pragma CODE_SEG __NEAR_SEG NON_BANKED // interrupt section for this module
_interrupt
void
UnimplementedISR(void)
{
for( ; ; );
// do nothing, but return from interrupt
}
#pragma CODE_SEG DEFAULT
typedef void (*near tIsrFunc)(void);
const
tIsrFunc _vect[ ] @0xFF80 5 { // interrupt-vector table starts from this line
// interrupt-vector table
UnimplementedISR,
. . .
. . .
rtiISR,
// RTI interrupt vector (at the address 0xFFF0)
. . .
. . .
};
The entry UnimplementedISR is provided as a catchall handler for all unintended inter-
rupts. If the user is not concerned about unintended interrupts, then the interrupt-vector table
can be reduced to
const tIsrFunc _vect [ ] @0xFFF0 5 { // 0xFFF0 is the address to store RTI vector
rtiISR
};
6.5.2 Interrupt Handling in ImageCraft ICC12
The ICC12 C compiler uses the #pragma statement to indicate that a function is an inter-
rupt service routine. For example, the following statements indicate that the function rtiISR( )
is an interrupt service routine:
#pragma interrupt_handler rtiISR
void riISR (void)
{
. . .
}
A pragma statement can declare several interrupt service routines separated by spaces.
When working with a demo board programmed with the D-Bug12 monitor, the user can
use the SetUserVector function provided by the D-Bug12 monitor to set up the interrupt vector.
The prototype declaration of the SetUserVector function is as follows:
int SetUserVector (int VectNum, Address UserAddress); — at $EEA4
The function argument VectNum refers to the vector number associated with the interrupt source
which is given in Table 6.3. The argument UserAddress is the interrupt vector of the interrupt
 
Search WWH ::




Custom Search