Keil™, An ARM® Company

C166 User's Guide

Cached Vectors

The C166 Compiler allows you to create cached interrupts in C. These interrupts execute more quickly than standard interrupts and are declared as follows:

void funcname (void) interrupt name=CACHED « using bankname »

Where

funcnameis the name of the function.
interruptindicates that the function is an interrupt function.
namemay be any name you choose for the interrupt vector.
CACHEDspecifies that the interrupt is a fast interrupt.
usingspecifies which register bank the function uses.
banknameis the register bank name.

When you define a fast interrupt using CACHED, you must specify interrupt address details (using the FINTxCSP and FINTxADDR SFRs) to the MCU. For example:

/* Macros to get the function segment and offset */
#define SEG(func) (unsigned int)(((unsigned long)((void (far *) (void))func) >> 16))
#define SOF(func) (unsigned int)(((void (far *) (void))func))

/* The fast interrupt service routine */
void serial_TX_irq (void) interrupt S0TINT=CACHED
{
ASC0_TBUF = 'A';
}
.
.
.
/* Configure the FINT0... SFRs to use serial_TX_irq */
FINT0CSP = 0x8800 | SEG(serial_TX_irq);
FINT0ADDR = SOF(serial_TX_irq);