Button Interrupt problem using Olimex AT91SAM7S256 demo board and package
I am using Olimex AT91SAM7S256 demo board and the package from Crossworks to build sample project. The purpose of the sample project is to test the button interrupt of AT91SAM7S256 MCU. I use some code from led and interrupt package, and the program is supposed to go in this way, when user click a button, the green LED turns on and off and then yellow LED turns on and off. I changed one part of the the code in ctl_olimex_sam7_p64.c,
//ctl_set_isr(PIOA_ID, 0, CTL_ISR_TRIGGER_LOW_LEVEL, buttonISR_PIOA, 0);
ctl_set_isr(PIOA_ID, 0, CTL_ISR_TRIGGER_POSITIVE_EDGE, buttonISR_PIOA, 0);
Because I want the interrupt occurs only once when clicking the button. However, the LEDs turns on and off TWICE.
int main(void)
{
ctl_board_init();
ctl_board_on_button_pressed(buttonPressed);
ctl_global_interrupts_enable();
while (1)
{
}
return 0;
}
In debug, I can see the PC stops within the buttonPressed() twice as I press one button.
Can anybody give me some idea how this does not work as I expected. Thank you very much!
Please sign in to leave a comment.
Comments
0 comments