ahatmob
Newbie level 5
- Joined
- Sep 15, 2014
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- egypt- cairo
- Activity points
- 54
i am trying to make 2 push button interrupt and to calculate the time elapsed between them using counter t and make the result displayed on port c
the problem is that portb rb4 is interrupting automatically i donot why there is my code
the problem is that portb rb4 is interrupting automatically i donot why there is my code
Code:
int x=0;
int t=0;
void interrupt(){
if(INTCON.F1){
x = portb;
INTCON.f0=0;
INTCON.F1=0;
}
else if(intcon.f0){
t++;
portc=t; } }
void main() {
trisc =0x00;
trisb =0xff;
portc =0;
portb=0;
option_reg =0x00;
INTCON =0x98;
/*for(;;){
portc = t;
delay_ms(1000);
}*/
}