Altera_Forum
Honored Contributor
14 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. does anyone now the solution of this problem? do i need to use the interrupt vector controller? thanks! #include <stdio.h> #include "system.h" #include "altera_avalon_timer_regs.h" #include "altera_avalon_pio_regs.h" #include "sys/alt_irq.h" #include"terasic_includes.h" void waypoint() { IOWR_ALTERA_AVALON_PIO_DATA(TEST_BASE, 0x1); IOWR_ALTERA_AVALON_TIMER_STATUS(WAYPOINT_BASE, 0); } void alpha() { IOWR_ALTERA_AVALON_PIO_DATA(ENA_BASE, 0x1); IOWR_ALTERA_AVALON_TIMER_STATUS(ALPHA_BASE, 0); } int main() { alt_irq_register( ALPHA_IRQ, null , alpha ); alt_irq_register( WAYPOINT_IRQ, null , waypoint ); return 0; }