Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

a problem about interrupt

hello ,i met a problem about interrupt,i define a led to test the initerrupt(when generate a interrupt the led is off) ,and a inputport (only 1BIT). The rising edge generate the interrupt.

the following is my code # include "system.h"# include "altera_avalon_pio_regs.h"# include "alt_types.h"

static void handle_PIO_1_interrupts(void* context, alt_u32 id)

{volatile int* nihao=(volatile int*)context;

*nihao=IORD_ALTERA_AVALON_PIO_EDGE_CAP(PIO_1_BASE);

IOWR_ALTERA_AVALON_PIO_EDGE_CAP(PIO_1_BASE,0);

IOWR_ALTERA_AVALON_PIO_IRQ_MASK(PIO_1_BASE,0Xf);

IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, 0);}

volatile int edge;

int main()

{

alt_irq_register(PIO_1_IRQ,(void*) &edge, handle_PIO_1_interrupts);

IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, 1);

while (1)

{;}

return 0;

}

can anybody help me,or give me an example about interrupt(except count_binary.c) thanks
No RepliesBe the first to reply