Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHow to use two interval timers
hello, i want to use two timers with my nios core. but with this code i can only use one timer. the second one wil not work. is there something wrong with my alt_irq_register(,,). declaration....
Altera_Forum
Honored Contributor
15 years agoIs the timer running?
Probably you need to initialize and start it. Try this in main: IOWR_ALTERA_AVALON_TIMER_CONTROL(ALPHA_BASE, 0); IOWR_ALTERA_AVALON_TIMER_PERIODL(ALPHA_BASE, (TPERIOD-1) & ALTERA_AVALON_TIMER_PERIODL_MSK); IOWR_ALTERA_AVALON_TIMER_PERIODH(ALPHA_BASE, ((TPERIOD-1)>>16) & ALTERA_AVALON_TIMER_PERIODL_MSK); alt_irq_register(ALPHA_IRQ, NULL, alpha); IOWR_ALTERA_AVALON_TIMER_CONTROL(ALPHA_BASE, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK | ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); Same for WAYPOINT timer.