Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12606 Discussions

multiple interrupts from a single push-io

Altera_Forum
Honored Contributor II
956 Views

Hi, 

 

How can I get just a single interrupts from a push-io. I have tried changing the SOPC for the push-io to generate only from a rising/falling edge change and that does not seem o help. 

 

basing myself off the counting binary example. They had it setup initially to generate interrupts on both the rising and falling edge, which is what I am seeing. however, I cannot seem to change that behaviour. 

 

Thanks, 

Vince
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
273 Views

Hi Vmathieu, 

 

Switches don't always open and close in one clean change of state, they often 'bounce' a bit. Maybe your interrupt is responding to this. 

If you are just getting multiple interrupts then maybe you aren't clearing the interrupt source i.e. writing to the PIO edge capture register. 

 

Banx.
0 Kudos
Altera_Forum
Honored Contributor II
273 Views

 

--- Quote Start ---  

originally posted by banx@Sep 7 2006, 03:15 PM 

hi vmathieu, 

 

  switches don't always open and close in one clean change of state, they often 'bounce' a bit. maybe your interrupt is responding to this. 

  if you are just getting multiple interrupts then maybe you aren't clearing the interrupt source i.e. writing to the pio edge capture register. 

 

banx. 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=18140) 

--- quote end ---  

 

--- Quote End ---  

 

 

Hi, 

 

I am using some of the code from the tutorial thats clear the reg after getting an interrupt. See below. With this printf I have added I cleary see that I am getting an interrupt when pushing the button down, and then another when I release it. 

 

Thanks, 

Vince 

 

static void handle_button_interrupts(void* context, alt_u32 id) 

/* Cast context to edge_capture&#39;s type. It is important that this be  

* declared volatile to avoid unwanted compiler optimization. 

*/ 

volatile int* edge_capture_ptr = (volatile int*) context; 

/* Store the value in the Button&#39;s edge capture register in *context. */ 

*edge_capture_ptr = IORD_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE); 

printf("\n intrrpt\n"); 

/* Reset the Button&#39;s edge capture register. */ 

IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE, 0); 

}
0 Kudos
Reply