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 agoHello,
We have made several tests today, and the problem was solved. In fact it was easy, we have made a mistake during addressing the register and the during of the function of the timer is longer than the period of the timer. Below a code example for other user of this forum : // Declaration of the timer (500ms) IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_500M_BASE, 0); IOWR_ALTERA_AVALON_TIMER_PERIODL(TIMER_500M_BASE, 0x9680); IOWR_ALTERA_AVALON_TIMER_PERIODH(TIMER_500M_BASE, 0x0098); alt_irq_register( TIMER_500M_IRQ, null, TIMER500M_IRQ); IOWR_ALTERA_AVALON_TIMER_CONTROL(TIMER_500M_BASE, ALTERA_AVALON_TIMER_CONTROL_CONT_MSK | ALTERA_AVALON_TIMER_CONTROL_START_MSK | ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); // Snapshot IOWR_ALTERA_AVALON_TIMER_SNAPL(TIMER_500M_BASE, 0x00); periodl=IORD_ALTERA_AVALON_TIMER_SNAPL(TIMER_500M_BASE); periodh=IORD_ALTERA_AVALON_TIMER_SNAPH(TIMER_500M_BASE); Thanks again for your help.