I’m trying to program an interrupt for the LPC-2148
It seems there’s not that much information about interrupts using the
YAGARTO GCC-compiler…
This is what I already have/tried/found on other sites (only interrupt
code):
/* *********************************************************
Function declarations
********************************************************* */
#include “lpc214x.h” //header file
#define PLOCK 0x400
void Initialize(void);
void feed(void);
void attribute ((interrupt(“IRQ”))) IRQ_Routine(void) ;
void attribute ((interrupt(“FIQ”))) FIQ_Routine(void) ;
void attribute ((interrupt(“SWI”))) SWI_Routine (void) ;
void attribute ((interrupt(“UNDEF”)))UNDEF_Routine (void);
void Initialize(void) {
PLLCFG=0x24;
feed();
PLLCON=0x1;
feed();
while(!(PLLSTAT & PLOCK)) ;
PLLCON=0x3;
feed();
MAMCR=0x2;
MAMTIM=0x4;
VPBDIV=0x02;
}
void feed(void)
{ PLLFEED=0xAA;
PLLFEED=0x55;
}
void delay_ms(long ms)
{
unsigned long i,j;
for(i=0;i<ms;i++) // Time delay function
for(j=0;j<6653;j++);
}
/**********************************************************
MAIN
**********************************************************/
void main(void)
{ Initialize();
IODIR0 |= (1<<21);
IOSET0 |= (1<<21);
EXTMODE |= 0x4;
PINSEL0=0xC000; //15:14
VICVectAddr0=(unsigned)IRQ_Routine;
VICVectCntl0= 0x20 | 16;
VICIntEnable |= 1<<16;
while(1);
}
void attribute ((interrupt(“IRQ”))) IRQ_Routine(void)
{
IOCLR0 |= (1<<21);
EXTINT|=0x4; //Clear EINT2 interrupt flag
VICVectAddr=0;
}
void FIQ_Routine(void)
{
while(1);
}
void SWI_Routine (void)
{
while(1);
}
void UNDEF_Routine (void) {
while (1) ;
}
It compiles without any errors/warnings, but it doesn’t work. The µC
never jumps to the interrupt-routine.
Can’t find more information about this :-(. Anyone knows
what I’m doing wrong?