I'm trying to blink diode, using timer0 MR0 irq. The problem is that the irq works only one time. I see diode is just blinking once and nothing else.
I localized the issue and here's the code:
#include <lpc23xx.h> void t0_irq() __irq { if(T0IR&1) { T0IR=1;//reset irq if(FIO0PIN & (1<<9)) //if pin on { FIO0CLR = (1<<9); //pin off } else { FIO0SET = (1<<9);//else pin on } } } int main() { //setup diode SCS |= 1; //enable FIO PINSEL0 &=~0x000C0000; FIO0DIR |= (1<<9); FIO0SET = (1<<9); //setup timer0 PCONP |= (1 << 1); // power up timer 0 T0CTCR = 0; // timer only mode */ T0TCR = 0; // disable timer 0 PCLKSEL1 &= ~0x0000000C; PCLKSEL0 |= 0x00000004; // timer 0 clock = PCLCK T0IR = 0xFF; // reset irq flag T0PR = 0x00208D55; // prescaler T0MR0 = 5; // match register 0 // configure VIC VICIntEnClr |= (1 << 4); // irq disabling VICIntSelect &= ~(1 << 4);// IRQ interrupt //VICVectPriority4 = 2; // priority VICVectCntl4 =2; // (i use old naming convention here) VICVectAddr4 = (unsigned long)&t0_irq; // ISR address VICIntEnable |= (1 << 4); // irq enable T0MCR |= 0x03; // irq and TC reset on MR0 T0TCR = 0x01; // start timer while(1) { } }