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

Trying to enable interrupt on PIN_B0

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







Trying to enable interrupt on PIN_B0
PostPosted: Mon Apr 13, 2009 6:21 pm     Reply with quote

Version : 4.013
Pic: PIC18F4550

I am trying to enable interrupts on RB0 with no luck so far. It's working fine for pins B4 ,B5,B6, and B7 but not B0. Any idea why ? or how to fix this ?
The code I'm using is the following:


Code:

#int_rb
void myfunc_isr() {
     int8 dd;
customflag=6;   
   dd = input_B();
}

void main()
{

  SET_TRIS_B(0xFF);
  ext_int_edge(L_TO_H);

  port_b_pullups(TRUE);
  clear_interrupt(INT_RB);
  ENABLE_INTERRUPTS(INT_RB);   
  ENABLE_INTERRUPTS(INT_RTCC);
  ENABLE_INTERRUPTS(INT_RDA); 
  ENABLE_INTERRUPTS(GLOBAL);
setup_adc(ADC_OFF);

while (customflag !=-1){
   lcdputc("interrupt_driven");
   customflag =-1;}

}

}
Guest








PostPosted: Mon Apr 13, 2009 6:56 pm     Reply with quote

Hi,

I don't know if this is your problem, but on most PICs, pin B0 is the external interrupt pin. The CCS interrupt handler for this pin is usually INT_EXT rather than INT_RB. In any event, it's an easy thing to test.....

Jeff
Guest








PostPosted: Mon Apr 13, 2009 8:48 pm     Reply with quote

Hi Again,

I checked the datasheet for the 18F4550 and it has three external interrupt pins INT0, INT1, and INT2, so the solution to your problem will be to use the EXT_INT0 interrupt handler.

Jeff
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