--- 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'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'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's edge capture register. */
IOWR_ALTERA_AVALON_PIO_EDGE_CAP(BUTTON_PIO_BASE, 0);
}