Forum Discussion
Altera_Forum
Honored Contributor
14 years agoUsing 2 timers ?
We are trying to use 2 interval timer (200ms and 500ms) on a nios 2 processor. One is configure as a system clock timer and its work fine., but the second don’t ...
Altera_Forum
Honored Contributor
14 years agoWe have tried your solution unfortunately it’s the same problem. Only one timer works and we can’t read the period programmed and the snapshot value. Both interval timer are declared as custom timer on SOPC Builder.
Here the code for the 500ms timer (same code for 250ms) : // declaration of the 500ms timer IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_500M_IRQ, 0); IOWR_ALTERA_AVALON_TIMER_PERIODL(TIMER_500M_IRQ, 0x9680); IOWR_ALTERA_AVALON_TIMER_PERIODH(TIMER_500M_IRQ, 0x0098); alt_irq_register( TIMER_500M_IRQ, NULL, TIMER500M_IRQ); IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_500M_IRQ, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK | ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); // reading with the snapshot IOWR_ALTERA_AVALON_TIMER_SNAPL(TIMER_500M_IRQ, 0x00); periodl=IORD_ALTERA_AVALON_TIMER_SNAPL(TIMER_500M_IRQ); periodh=IORD_ALTERA_AVALON_TIMER_SNAPH(TIMER_500M_IRQ); Do you have a code example ? Thanks