Altera_Forum
Honored Contributor
16 years agoInterruption problem with buttons
Hello,
I have a problem generating interruptions. I had a design which was working with buttons on pooling. I then changed conditions in SOPC and put synchronously capture on rising edge and generate irq on edge. The number of my irq is 1. I compiled my design again and put the following program which was on the NIOS II forum. when I press a button, nothing changes and the Nios console keeps displaying "main runing..." Did I forget something in Quartus II for handling interruptions? Thank you, Myriam Program : # include <stdio.h># include "sys/alt_irq.h" static void my_isr(void* context, alt_u32 id) { int* button = (int *)context; if( id == 1 ) //test interruption id *button = 1; else *button = 0; } int main(){ alt_u32 id = 1; volatile int button=0; printf("start:\n"); alt_irq_register( id, (void*)&button, my_isr ); while(1){ if(button!=0) { printf("exception runing...\n"); button=0; } else printf("main runing...\n"); } return 0; }