Hi everyone,
I was wondering if anyone could help.
I have written a little code, essentially I'm using External RB0 interrupt, Port change RB4 interrupt and TIMER_0 interrupt.
When bit 5 of INTCON is set to 1 (Enable timer), my program jumps automatically to the ISR; skipping the while loop.
But If the bit 5 INTCON is set to 0, the program works fine and I can use my OTHER interrupts.
The code:
Mod edit: code tags
I was wondering if anyone could help.
I have written a little code, essentially I'm using External RB0 interrupt, Port change RB4 interrupt and TIMER_0 interrupt.
When bit 5 of INTCON is set to 1 (Enable timer), my program jumps automatically to the ISR; skipping the while loop.
But If the bit 5 INTCON is set to 0, the program works fine and I can use my OTHER interrupts.
The code:
C:
void setup(void);
void __interrupt() inSetup(void){
DO SOMETHING !
return;
}
//Main Function
void main(void)
{
setup();
while(1){
}
}
void setup(void) {
// Port configuration
TRISB = 0B11111111;// Setting 'B' as input
TRISA = 0B00000;// Setting 'A' as output
OUTPUT_PIN1 = 0;
OUTPUT_PIN2 = 0;
// TIMER_0 & INTERRUPT SETUP
INTCON = 0b10100000;
OPTION_REG = 0b10000111; //bit 2 - bit 0 pre-scaler assignment 1:2,
}
Last edited by a moderator: