CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

INT_EXT interrupting in enable

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Breno



Joined: 20 Jul 2006
Posts: 5
Location: Belo Horizonte, Brazil

View user's profile Send private message Visit poster's website MSN Messenger

INT_EXT interrupting in enable
PostPosted: Mon Jul 31, 2006 4:47 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Jul 31, 2006 4:55 pm     Reply with quote

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

View user's profile Send private message Visit poster's website MSN Messenger

PostPosted: Mon Jul 31, 2006 5:11 pm     Reply with quote

Thanks man, this has fixed the problem.

But I also tried something that worked: configuring the portb directions after the enable_interrupts.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group