• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

handling IO interrupts pic16f628a hitech c lite

Status
Not open for further replies.

normad

Member
hey guys..

i enabled my globle interrupts (GIE = 1) and the port b interrupts(RBIE = 1) and followed the usual manner of handling the interrupt but for some reason my interrupt function seems to be running all the time.. in the case of external interrupts we dont have to read from a flag like timers do we?
what i did was check if my pin is high

void interrupt int_handler(void) {

if(RB0) {

//do this and that

}

}

is there something wrong in my method.. do i have to clear any particular bit to exit the interrupt function
 

LTX71CM

New Member
in the case of external interrupts we dont have to read from a flag like timers do we?
Yes, you do.

Code:
void interrupt int_handler(void) {
        if(RBIF) {
                //do this and that
                RBIF=0;
        }
}
If you only need to check one pin use the RB0/INT, INTE=1; Then from your ISR check and clear INTF.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading

 
Top