Forum Discussion
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- You say you are using the interval timer. How are you using it? Because the interval timer can also be used with interrupts. The way I would imagine your system should work is: 1) Initialize timer to 0.2 seconds 2) once the timer runs out (if interrupts for the timer are enabled) it will trigger an interrupt 3) In the ISR for the timer you would a) read ADC, b) put ADC value into PutUart 4) Reset timer interrupt bit, reset timer to 0.2 seconds I don't see how the timer is used in your case. To check if interrupts are enabled all you have to do is read the value outputted from irq_enable and ic_isr_register. If both output 0 then the interrupts are enabled. If they output -1 then there was an error. I don't think you'll have errors. To set up interrupts for the timer, you would connect the irq in qsys, then use the same irq_enable and ic_isr_register command, but instead of UART IDs and IsrUart and context_uart you would use TIMER IDs, IsrTimer (which you would have to create) and context_timer. In IsrTimer you will do steps 2 - 4. Timers count down from your set value to 0. Read timer documentation on how to reset the timer interrupt. --- Quote End --- Thank you very much for your kind reply, currently I am not using interrupt for timer, i have the preset value and when bit TO is one, I know time is up. still need some time to implement timer interrupt, will keep it posted. Thank u again for your explanation.