|
|
View previous topic :: View next topic |
Author |
Message |
seme1 Guest
|
Trying to enable interrupt on PIN_B0 |
Posted: Mon Apr 13, 2009 6:21 pm |
|
|
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
|
|
Posted: Mon Apr 13, 2009 6:56 pm |
|
|
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
|
|
Posted: Mon Apr 13, 2009 8:48 pm |
|
|
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 |
|
|
|
|
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
|