Altera_Forum
Honored Contributor
20 years agoProgramming of Timer Interrupt???
I have set up one NIOS2, one ONCHIP_RAM(4K), one INTERNAL_TIMER and four PIO in the SOPC builder. my board use 25Mhz osicllation.
I want to design a timer interrupt routine, just for glittering the LEDs. int main (void) __attribute__ ((weak, alias ("alt_main"))); alt_u8 x = 0x5; static void timer_interrupts(void* context, alt_u32 id) { IOWR_ALTERA_AVALON_TIMER_STATUS(SYS_TIMER_BASE, 0);//clear TO IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, x);//light LEDs if(x==5)x=0xA; else x=5; } int alt_main (void) { alt_irq_register(SYS_TIMER_IRQ, (void*)&x, timer_interrupts); IOWR_ALTERA_AVALON_TIMER_PERIODL(SYS_TIMER_BASE, 0xBC20); IOWR_ALTERA_AVALON_TIMER_PERIODH(SYS_TIMER_BASE, 0xBE); IOWR_ALTERA_AVALON_TIMER_CONTROL(SYS_TIMER_BASE, 7); while (1) { ; } return 0; } built complete!!! when I downlaod program to EP1c12, but the console said verify failed http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif what's wrong with my routine??? the hardware is ok and i can download the hello_led routine.