Forum Discussion
Altera_Forum
Honored Contributor
16 years agoProblem about interval timer
Hi guys now i want to use the interval timer as interrupt to send a 40khz sine wave to i/o port.but when i set the interval timer as 1us which equals the sampling frequecy of ad5547(1mhz),it does'...
Altera_Forum
Honored Contributor
16 years agoThank you a lot!
I do it as you said.But it still has some problems. Now the cpu frequency is 160MHz,and I set the timer interval as: IOWR_ALTERA_AVALON_TIMER_PERIODL(TIMER_BASE,0x0063); IOWR_ALTERA_AVALON_TIMER_PERIODH(TIMER_BASE,0x0000); and this means 100 divided-frequency.The result is not 40KHz but 13.36KHz.Besides,I set the number as 0x031f(799),0x018f(399),0x00c7(199),then I watch the SignalTap II,found that when the number is 199 or 99,every timer interval is not equal.And when setting the number as 799,the result is 4KHz,399 as 8KHz,it's totally correct! IOWR_ALTERA_AVALON_PIO_DATA(PIO_BASE,0x0001); IOWR_ALTERA_AVALON_PIO_DATA(PIO_BASE,0x0002); I can't upload the pic,I discribe it simply.In some periods 1 and 2 have less than 100 cpu clock periods. I think the timedigram may have something wrong in it or the time settings in Quartus II is not met?