hbaocr
Full Member level 4
hello;
I have make example code for IRQ timer match0 and I have som problems
please help me!
why my program loop at ISRIRQ_Match0_timer0 forever( return and then immediately jump to ISR again and again without working function in main program to Increase a value).So variabe f intially change (f=a) at first match occur and until the other match occurr following it ,variale a don't change (it don't increase)
#include "LPC214x.H"
#include "stdio.h"
//CCLK=12xM=12x5=60MHZ
//PCLK=CCLK (VPBDIV=0x00)
void IRQ_Match0_timer0(void)__irq;
unsigned int a;
unsigned int f;
int main()
{
//int timer0
T0TCR=0x3;//TC and PR count enable
T0PR=59;//tan so dem cua TC = PCLK/(PR+1)=1MHz-> 1us
T0MCR=0x1;//interrupt match0 enable and TC reset when match
T0MR0=3;//10us for TC reaches to T0MR0 and occur match0
//interrupt
VICVectCntl0=0x24;//choose Source Int Timer0=4, and enable IRQ slot
VICVectAddr0=(unsigned) IRQ_Match0_timer0;
VICIntEnable=1<<4;//enable Timer0 interrupt source
T0TCR=0x1;
while(1)
{
a++;
}
}
void IRQ_Match0_timer0(void)__irq
{
f=a ;
T0IR=0;
VICVectAddr = 0x00000000; // Reset Global Interrupt and return
}
I have make example code for IRQ timer match0 and I have som problems
please help me!
why my program loop at ISRIRQ_Match0_timer0 forever( return and then immediately jump to ISR again and again without working function in main program to Increase a value).So variabe f intially change (f=a) at first match occur and until the other match occurr following it ,variale a don't change (it don't increase)
#include "LPC214x.H"
#include "stdio.h"
//CCLK=12xM=12x5=60MHZ
//PCLK=CCLK (VPBDIV=0x00)
void IRQ_Match0_timer0(void)__irq;
unsigned int a;
unsigned int f;
int main()
{
//int timer0
T0TCR=0x3;//TC and PR count enable
T0PR=59;//tan so dem cua TC = PCLK/(PR+1)=1MHz-> 1us
T0MCR=0x1;//interrupt match0 enable and TC reset when match
T0MR0=3;//10us for TC reaches to T0MR0 and occur match0
//interrupt
VICVectCntl0=0x24;//choose Source Int Timer0=4, and enable IRQ slot
VICVectAddr0=(unsigned) IRQ_Match0_timer0;
VICIntEnable=1<<4;//enable Timer0 interrupt source
T0TCR=0x1;
while(1)
{
a++;
}
}
void IRQ_Match0_timer0(void)__irq
{
f=a ;
T0IR=0;
VICVectAddr = 0x00000000; // Reset Global Interrupt and return
}