Forum Discussion
Altera_Forum
Honored Contributor
14 years agoI think this is a problem:
volatile int* button; *button = IORD_ALTERA_AVALON_PIO_DATA(BUTTON_PIO_BASE); You are using an uninitialized pointer which will corrupt memory somewhere. The correct code is the one you commented out (but you need to define alt_u8 button, not alt_u8 *button). Moreover, IMHO it was correct to test button switching edge instead of button status. Now you always have delay=delayAmount=0 and whenever you press a button the function will keep on retriggering until you release it.