haxan
New Member
Hi. I am simply attaching a switch with pin RB0 (INT0) and trying to count number of times it is pressed. I am using C18 compiler and including file portb.h which is suppose to handle all the interrupts.
The problem is that the interrupt routine is not being called
Here is my code.
can anyone please guide me
The problem is that the interrupt routine is not being called
Here is my code.
Code:
#include <p18cxxx.h>
#include <delays.h>
#include <portb.h> /* for the RB0/INT0 interrupt */
#pragma config WDT = OFF, LVP = OFF, OSC = HS, DEBUG = OFF
/* ~~~~ Interrupt Handler ~~~~ */
void i_handler (void);
#pragma code i_interrupt = 0x08
void i_int (void)
{
_asm goto i_handler _endasm
}
#pragma code
#pragma interrupt i_handler
void i_handler (void)
{
//CloseRB0INT();
PORTCbits.RC6 ^= 1;
INTCONbits.RBIF = 0;
}
void main(void){
ADCON1 = 0xFF;
TRISA = 0b00011110;
TRISB = 0b11110000;
TRISC = 0x00;
OpenRB0INT(PORTB_CHANGE_INT_ON & PORTB_PULLUPS_OFF & RISING_EDGE_INT & PORTB_INT_PRIO_HIGH);
while(1)
{
}
}
can anyone please guide me