Hardware interrupt issue in PIC8f452

Status
Not open for further replies.

bilal shareef

Member level 1
Joined
Dec 11, 2010
Messages
36
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,549
Hello guys,
I am using PIC18f452 to count the number of times the pushbutton1 is pressed. I have used 2 push buttons , first is connected to Hardware interrupt (RB0/INT0) and second is connected to Simple GPIO. what i have done is that i have enabled and disabled the hardaware interrupt using second button, Now the issue is that when i start pressing button 1 before enabling the hardware interrupt, the INT0 pin tends to hold the signal and as soon as I press second button to enable the interrupt the controller due to that holded signal jumps to iNT0 ISR regardless of current state on INT0 Pin. But when i first enable the hardware interrupt and then give pulses on iNT0 pin then it works fine, So, Please tell me whats wrong when i give signal to INT0 first before enabling the INT0, Whats the issue ????
 

What edge are you detecting? Maybe you are detecting +ve edge (assuming your button input is high when pressed). Try detecting -ve edge.
 

You would normally ensure interrupt flags are clear just before enabling them.

Keith
 

thanks keith, the issue is solved now. It was because of flags...
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…