How to set up a timer
From DSWiki
Just a quick note. This code sets up a timer (TIMER0) at 1000Hz. An interrupt for the timer is registered that calls the function timerHandler on every tick, i.e. 1000 times a second.
u16 freq = 1000; TIMER0_DATA = TIMER_FREQ(freq); TIMER0_CR = TIMER_ENABLE | TIMER_DIV_1 | TIMER_IRQ_REQ; irqSet(IRQ_TIMER0, timerHandler); irqEnable(IRQ_TIMER0);
Important: The minimum argument of TIMER_FREQ is 512. Lower frequencies can be achieved using the TIMER_DIV_X flag.

