View previous topic :: View next topic |
Author |
Message |
Breno
Joined: 20 Jul 2006 Posts: 5 Location: Belo Horizonte, Brazil
|
INT_EXT interrupting in enable |
Posted: Mon Jul 31, 2006 4:47 pm |
|
|
I am having a problem with interrupts: when I enable INT_EXT, it imediatly goes to the interrupt routine, no matter what border it was configured. I am simulating this in proteus so there is no bouncing problem.
This initialize the interrupt:
Code: | ext_int_edge(H_TO_L);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL); |
This is the interrupt routine:
Code: | #INT_EXT
void int_isr(void)
{
c=spi_read(0);
lcd_putc(c);
} |
What should I do so the interrupt routine will only be accessed when the PIN_B0 gets low?
Thanks.
Breno
Last edited by Breno on Mon Jul 31, 2006 5:01 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jul 31, 2006 4:55 pm |
|
|
Quote: |
When I enable INT_EXT, it immediately goes to the interrupt routine. |
Add the line shown below. It may help.
Code: | ext_int_edge(H_TO_L);
enable_interrupts(INT_EXT);
clear_interrupt(INT_EXT); // Add this line
enable_interrupts(GLOBAL); |
|
|
|
Breno
Joined: 20 Jul 2006 Posts: 5 Location: Belo Horizonte, Brazil
|
|
Posted: Mon Jul 31, 2006 5:11 pm |
|
|
Thanks man, this has fixed the problem.
But I also tried something that worked: configuring the portb directions after the enable_interrupts. |
|
|
|