- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I try to make a simple demo program for interrupt TIMER on my DE2. Every second the LEDs on "SORTIES" port whill change. It does'nt work, could you help me .... In debug mode , i placed a breakpoint in the interrupt routine, but it is never expected. # include "sys/alt_stdio.h" # include "system.h" # include "altera_avalon_pio_regs.h" # include "altera_avalon_timer_regs.h" # include "sys/alt_irq.h" volatile unsigned int contexte_pour_IT; // sauvegarde du contexte de l'IT static void timer_flash(void* context) {static unsigned char n=0; n^=0xFF; // toggle bits // clear flag IT //IOWR(TIMER_0_BASE,ALTERA_AVALON_TIMER_STATUS_REG,ALTERA_AVALON_TIMER_STATUS_TO_OFST); IOWR_ALTERA_AVALON_TIMER_STATUS(TIMER_0_BASE,ALTERA_AVALON_TIMER_STATUS_REG); IOWR(SORTIES_BASE,0,n); } int main() { void* Timer_IT_ptr= (void*) &contexte_pour_IT; IOWR(TIMER_0_BASE,ALTERA_AVALON_TIMER_CONTROL_REG,ALTERA_AVALON_TIMER_CONTROL_ITO_MSK); IOWR(TIMER_0_BASE,ALTERA_AVALON_TIMER_PERIODL_REG,0x3E8); IOWR(TIMER_0_BASE,ALTERA_AVALON_TIMER_PERIODH_REG,0); alt_ic_isr_register(TIMER_0_IRQ_INTERRUPT_CONTROLLER_ID,TIMER_0_IRQ,timer_flash,Timer_IT_ptr,0); alt_irq_init(TIMER_0_BASE); while(1); }Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page