sreejith2904
Newbie level 1
- Joined
- Mar 21, 2011
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Thrissur / Kerala
- Activity points
- 1,302
Hello,
I was trying to create an interrupt using timer0 of my blueboard
lpc214x. I want to generate an interrupt from timer0 and to execute an interrupt routine when it occurs. Referring to the thread
https://www.edaboard.com/threads/202311/ , i have made slight changes to the code :-
I was expecting to see a varying voltage around every pin of port0 making it GPIO, so that an led blinks (happening this every time the interrupt is triggered). But it is seen that the voltage from pins remains around 3V.
I am using arm-eabi for compiling and linking code. Please help me with this. :???: Do i have to add some extra code along with this inorder to enable global interrupt or so....???
I was trying to create an interrupt using timer0 of my blueboard
lpc214x. I want to generate an interrupt from timer0 and to execute an interrupt routine when it occurs. Referring to the thread
https://www.edaboard.com/threads/202311/ , i have made slight changes to the code :-
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 #include "LPC214x.h" #define PLOCK 0x400 void init(void); void IRQ_Routine(void) __attribute__ ((interrupt ("IRQ"))); void FIQ_Routine (void) __attribute__ ((interrupt("FIQ"))); void SWI_Routine (void) __attribute__ ((interrupt("SWI"))); void UNDEF_Routine (void) __attribute__ ((interrupt("UNDEF"))); int main(void) { PINSEL0 = 0x00000000; init(); T0MCR = 0x0003; //interrupt and reset on MR0 T0MR0 = 0x00ffffff; //compare-hit count T0TCR |= 0x02; //reset counter T0TCR |= 0x01; //enable Timer0 VICVectAddr0 = (unsigned long)&IRQ_Routine; //set interrupt vector in 0 //or //VICVectAddr0 = (unsigned long)IRQ_Routine; //set interrupt vector in 0 VICVectCntl0 = 0x00000024; //use it for Timer 0 Interrupt VICIntSelect = 0x00000000; //Configure for IRQ VICIntEnable = 0x00000010; //enable TIMER0 interrupt while(1); } void IRQ_Routine(void) { volatile int i; PINSEL0 = 0x00000000; IODIR0 = 0xffffffff; IOSET0 = 0xffffffff; for(i=0;i<0x0000ffff;i++); IOCLR0 = 0xffffffff; for(i=0;i<0x0000ffff;i++); T0IR = 0x01; //clear interrupt VICVectAddr0 = 0; //end of interrupt - dummy write } void init(void) { PLLCFG=0x24; //set multiplier/divider values PLLFEED=0xaa; PLLFEED=0x55; PLLCON=0x01; //enable PLL PLLFEED=0xaa; PLLFEED=0x55; while(!(PLLSTAT & PLOCK)); //wait for the PLL to lock to set frequency PLLCON=0x3; //connect the PLL as the clock source PLLFEED=0xaa; PLLFEED=0x55; MAMCR=0x02; //enable MAM MAMTIM=0x04; //set number of clocks for flash memory fetch VPBDIV=0x01; //set peripheral clock(pclk) to system clock(cclk) } void FIQ_Routine(void){ while (1) ; } void SWI_Routine(void){ while (1) ; } void UNDEF_Routine(void) { while (1) ; }
I was expecting to see a varying voltage around every pin of port0 making it GPIO, so that an led blinks (happening this every time the interrupt is triggered). But it is seen that the voltage from pins remains around 3V.
I am using arm-eabi for compiling and linking code. Please help me with this. :???: Do i have to add some extra code along with this inorder to enable global interrupt or so....???