Discussion group dedicated to the Philips LPC2000 family of ARM MCUs
Olimex lpc e2294 board interrupt help - GNU C - boje_d - Jul 28 8:32:00 2005
Hi im trying to make the interrupt work om a lpc2294. I am using
timer 0 and see the interrupt being enabled (test routine on display)
but the interrupt does NOT activate the interrupt routine. Ill put in
some code so maybe someone can see my error??? And give a little
help ??
than you (i hope)
Best regards
Boje Demant
interrupt routine
static void Timer0Interrupt(void) __attribute__ ((interrupt ("IRQ")));
static void Timer0Interrupt(void){
// (*timer_function)(); // Call timer callback function.
//
// T0_TCR=0; //stop timer
// T0_TCR=2; //Reset timer
// T0_TCR=1; //start timer
LIGHT_LCD_ON;
T0_IR = 0xff; // Clear timer 0 interrupt line.
VICVectAddr=0xff;
}
in main:
T0_PR=58982; //setup prescaler = 1msek
T0_TCR=0x00000002; //Reset timer
T0_MR0= 1500; //2 (2 sek for interrupt;
T0_MCR=0x00000003; //generate interrupt on match
VICProtection=0; //
VICIntEnClear=0xffffffff; //disable all interrupts
VICSoftIntClear=0xffffffff;
VICDefVectAddr=(unsigned long)&DefInterrupt;
VICIntSelect=0x00000000; //assigne interrupt timer 0 til type IRQ
VICVectAddr0= (unsigned long)&Timer0Interrupt; //opsæt vector
VICVectCntl0= 0x00000024; //enable vector iterrupt

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
Re: Olimex lpc e2294 board interrupt help - GNU C - DECwiz \Fred van Kempen\ - Jul 28 9:53:00 2005
In the ISR, you need to reset the VIC using 0x00, not ff:
VICVectAddr = 0;
will work.
Also, in main:
VICIntSelect=0x00000000; //assigne interrupt timer 0 til type IRQ
will not work.. you need to SET the bit for the specific VIC channel, such as:
VICIntSelect |= (1 << VIC_TIMER0);
or alike.
--fred
boje_d <boje_demant@boje...> wrote:
Hi im trying to make the interrupt work om a lpc2294. I am using
timer 0 and see the interrupt being enabled (test routine on display)
but the interrupt does NOT activate the interrupt routine. Ill put in
some code so maybe someone can see my error??? And give a little
help ??
than you (i hope)
Best regards
Boje Demant
interrupt routine
static void Timer0Interrupt(void) __attribute__ ((interrupt ("IRQ")));
static void Timer0Interrupt(void){
// (*timer_function)(); // Call timer callback function.
//
// T0_TCR=0; //stop timer
// T0_TCR=2; //Reset timer
// T0_TCR=1; //start timer
LIGHT_LCD_ON;
T0_IR = 0xff; // Clear timer 0 interrupt line.
VICVectAddr=0xff;
}
in main:
T0_PR=58982; //setup prescaler = 1msek
T0_TCR=0x00000002; //Reset timer
T0_MR0= 1500; //2 (2 sek for interrupt;
T0_MCR=0x00000003; //generate interrupt on match
VICProtection=0; //
VICIntEnClear=0xffffffff; //disable all interrupts
VICSoftIntClear=0xffffffff;
VICDefVectAddr=(unsigned long)&DefInterrupt;
VICIntSelect=0x00000000; //assigne interrupt timer 0 til type IRQ
VICVectAddr0= (unsigned long)&Timer0Interrupt; //opsæt vector
VICVectCntl0= 0x00000024; //enable vector iterrupt
SPONSORED LINKS
Microcontrollers Microprocessor Intel microprocessors Pic microcontrollers 8085
microprocessor
---------------------------------
YAHOO! GROUPS LINKS
---------------------------------
---------------------------------
Start your day with Yahoo! - make it your home page
[Non-text portions of this message have been removed]

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
Re: Olimex lpc e2294 board interrupt help - GNU C - Angel Sanchez - Jul 28 10:45:00 2005
You have a couple of faults:
In Interruption: VicVectAddr = 0; (Not 0xff)
In main, include:
VicIntEnable = 0x10; // Enable timer 0 interrupt
Regards
--- In lpc2000@lpc2..., "DECwiz \(Fred van Kempen\)"
<decwiz@y...> wrote:
> In the ISR, you need to reset the VIC using 0x00, not ff:
>
> VICVectAddr = 0;
>
> will work.
>
> Also, in main:
>
> VICIntSelect=0x00000000; //assigne interrupt timer 0 til type
IRQ
>
> will not work.. you need to SET the bit for the specific VIC
channel, such as:
>
> VICIntSelect |= (1 << VIC_TIMER0);
>
> or alike.
>
> --fred
> boje_d <boje_demant@h...> wrote:
> Hi im trying to make the interrupt work om a lpc2294. I am using
> timer 0 and see the interrupt being enabled (test routine on
display)
> but the interrupt does NOT activate the interrupt routine. Ill put
in
> some code so maybe someone can see my error??? And give a little
> help ??
>
> than you (i hope)
>
> Best regards
> Boje Demant
>
> interrupt routine
> static void Timer0Interrupt(void) __attribute__ ((interrupt
("IRQ")));
> static void Timer0Interrupt(void){
> // (*timer_function)(); // Call timer callback function.
> //
> // T0_TCR=0; //stop timer
> // T0_TCR=2; //Reset timer
> // T0_TCR=1; //start timer
> LIGHT_LCD_ON;
> T0_IR = 0xff; // Clear timer 0 interrupt line.
> VICVectAddr=0xff;
> }
>
>
> in main:
>
> T0_PR=58982; //setup prescaler = 1msek
> T0_TCR=0x00000002; //Reset timer
> T0_MR0= 1500; //2 (2 sek for interrupt;
> T0_MCR=0x00000003; //generate interrupt on match
> VICProtection=0; //
> VICIntEnClear=0xffffffff; //disable all interrupts
> VICSoftIntClear=0xffffffff;
> VICDefVectAddr=(unsigned long)&DefInterrupt;
> VICIntSelect=0x00000000; //assigne interrupt timer 0 til type
IRQ
> VICVectAddr0= (unsigned long)&Timer0Interrupt; //opsæt vector
> VICVectCntl0= 0x00000024; //enable vector iterrupt
>
>
> SPONSORED LINKS
> Microcontrollers Microprocessor Intel microprocessors Pic
microcontrollers 8085 microprocessor
>
> ---------------------------------
> YAHOO! GROUPS LINKS
>
> ---------------------------------
>
>
> ---------------------------------
> Start your day with Yahoo! - make it your home page
>
> [Non-text portions of this message have been removed]

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )