Forum Discussion
Altera_Forum
Honored Contributor
12 years agotimer problem
I'm new to altera and c-programming. Just can't make the internal timer work. int main(void) { volatile int * red_leds =(int*) 0x10000000; volatile int * timer =(int*) 0x1000200...
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- IOWR_ALTERA_AVALON_TIMER_PERIODL (INTERVAL_TIMER_BASE + 0x8, 0x6500); IOWR_ALTERA_AVALON_TIMER_PERIODH (INTERVAL_TIMER_BASE + 0xC,0x1dcd); IOWR_ALTERA_AVALON_TIMER_CONTROL (INTERVAL_TIMER_BASE + 0x4, 0x4); run=IORD_ALTERA_AVALON_TIMER_STATUS(INTERVAL_TIMER_BASE); --- Quote End --- Timer macros already include the offset. The correct usage is: IOWR_ALTERA_AVALON_TIMER_PERIODL (INTERVAL_TIMER_BASE, 0x6500); IOWR_ALTERA_AVALON_TIMER_PERIODH (INTERVAL_TIMER_BASE, 0x1dcd); IOWR_ALTERA_AVALON_TIMER_CONTROL (INTERVAL_TIMER_BASE , 0x4);