sangeo
Member level 2
- Joined
- Jun 2, 2013
- Messages
- 44
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,647
Haii all I have a problem related with Microc PIC IDE (v8.2)
I have 2 timer interrupts(tmr2,tmr1) in my program..like this..
But when Timer 2 Enables in main program (PIE1.TMR2IE = 1) ,both of two interrupts(cnt and cnt2) get incremented ...why ?/
Initialization of Registers are like this..
I have 2 timer interrupts(tmr2,tmr1) in my program..like this..
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 void interrupt(){ if (PIR1.TMR1IF) { PIR1.TMR1IF=0; cnt++ ; TMR1H = 0x80; TMR1L = 0x00; } else if(PIR1.TMR2IF) { PIR1.TMR2IF=0; cnt2++ ; TMR2 = 0; } }
But when Timer 2 Enables in main program (PIE1.TMR2IE = 1) ,both of two interrupts(cnt and cnt2) get incremented ...why ?/
Initialization of Registers are like this..
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 T1CON = 1; T2CON = 0xFF; // Timer2 settings TMR2 = 0; TMR1H = 0x80 TMR1L = 0x00; INTCON = 0xC0; PIE1.TMR2IE = 0; PIE1.TMR1IE = 0; PIR1.TMR1IF=0; PIR1.TMR2IF=0; cnt=0; cnt2 = 0;
Last edited by a moderator: