darktangent
Junior Member level 2

Hi, I am using the following code, but intterupts do not launch once the RB0 goes high.
Can you find a problem.
Can you find a problem.
Code:
#include <p18f452.h>
#include <delays.h>
#pragma config WDT = OFF
void chk_isr(void); //Interrupt Handler
void inc_count(void);
void dec_count(void);
// Code to Be placed inthe Interrupt Handler
#pragma code My_HiPrio_Int = 0x08
void My_HiPrio_Int(void){
_asm
GOTO chk_isr
_endasm
}
#pragma code //end of interrupt vector table
#pragma interrupt chk_isr // Our Interrupt Service Routine
void chk_isr(void){
if(INTCONbits.INT0IF == 1) inc_count();
if(INTCON3bits.INT1IF == 1) dec_count();
}
void display_count(void);
char count = 0;
char segment[] = {0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void main(void){
TRISC = 0;
TRISD = 0;
TRISBbits.RB0 = 1;
TRISBbits.RB1 = 1;
INTCONbits.INT0IF = 0;
INTCONbits.INT0IE = 1;
INTCON3bits.INT1IE = 1;
INTCONbits.GIE = 1;
while(1){
display_count();
}
}
void display_count(void){
char MSB;
char LSB;
MSB = count / 10;
LSB = count % 10;
PORTC = segment[MSB];
PORTD = segment[LSB];
}
void inc_count(void){
count++;
INTCONbits.INT0IF == 0;
}
void dec_count(void){
count--;
INTCON3bits.INT1IF == 0;
}