UroBoros
Advanced Member level 2
- Joined
- May 5, 2004
- Messages
- 642
- Helped
- 19
- Reputation
- 38
- Reaction score
- 8
- Trophy points
- 1,298
- Location
- Cochin - India
- Activity points
- 6,463
I am trying to make a interrupt driven code on this chip. I am using timer 0 and timer 6 here. This is my initialization code for timer 6 and interrupt. The overflow flag is getting set as expected. I can it polled positive in mainline also. The timing is also happening as expected. But simply interrupt is not throwing. what is I am missing here?
Timer0 code is giving interrupts as expected, but timer 6 is not vectoring to ISR on overflow.
Thanks
Timer0 code is giving interrupts as expected, but timer 6 is not vectoring to ISR on overflow.
Code:
//*******************************************************************************
//for 1ms - 1 clock cycle 15.625nSec @ 64Mhz. 1 instruction cycle 62.5nS.
//Prescalar 16, postscalar 4 and reload value 250 will give 1ms interrupt
void Timer6_ini(void)
{
T6CON = 0b00011011;
TMR6=0; //Clear Timer
PR6=250; //Reload value for 1ms
PIR5bits.TMR6IF=0; //Timer6 flag cleared(2nd bit 0 clear)
IPR5bits.TMR6IP=0; //Timer6 interrupt on low priority(2nd Bit - 0)
PIE5bits.TMR6IE=1; //Timer6 interrupt enabled(2nd bit enabled)
PMD0bits.TMR6MD=0; //Timer6 module not disabled
T6CONbits.TMR6ON = 1; //Enable the timer.
}
//*******************************************************************************
void EnableInterrupts(void)
{
RCONbits.IPEN=1; // interrupt priority enabled (7tH bit)
INTCONbits.GIE=1; //global interrupt enabled
INTCONbits.PEIE=1; // all interrupts enabled
Nop();
}
//**********************************************************************************/