ARM Technical Support Knowledge Articles

USING XC16X FAST INTERRUPTS

Applies to: C166 C Compiler

Answer


Information in this article applies to:


QUESTION

For very fast interrupt response time, the interrupt controller of Infineon XC16x (XC164, XC161, XC167) devices can be programmed to use a jump table cache instead of going through the interrupt vector table.

How can I use fast (cached) interrupts in C?

ANSWER

The Keil C-Compiler supports fast (cached) interrupts. An interrupt service routine (ISR) can be defined with "<Name>=CACHED" instead of an interrupt vector number. In this case, no interrupt vector is generated.

The application needs to program the interrupt controller registers FINTxCSP and FINTxADDR with the address of the ISR before the interrupt is enabled. Following is an example:

#include <XC167.H>

//-------------------------------------------------------------

unsigned long CC1_Counter;

void CC1_T0Int(void) interrupt AnyName=CACHED
{
  CC1_Counter++;
}

//-------------------------------------------------------------
#define SEG(func) (unsigned int)(((unsigned long)((void (far *) (void))func) >> 16))
#define SOF(func) (unsigned int)(((void (far *) (void))func))

void main(void)
{
  CC1_T01CON = 0x0040;   // start timer 0 with prescaler=8
  CC1_T0IC   = 0x007C;   // set timer0 ILVL=15, GLVL=0, GPX=0

// Initialize fast interrupt register: EN=1, ILVL=15, GLVL=0, GPX=0
  FINT0CSP   = SEG(CC1_T0Int) | 0x8C00;
  FINT0ADDR  = SOF(CC1_T0Int);

  PSW_IEN    =  1;       // set global interrupt enable

  while(1);              // an embedded application never leaves main
}
//-------------------------------------------------------------

MORE INFORMATION

SEE ALSO

Article last edited on: 2004-06-29 09:08:04

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential