# DSPIC30f timer1 not trigger everytime on POR

I am using timer1 on DSPIC30f4011 to generate an interrupt every one millisecond. However, the timer1 ISR is not executed every time on POR (2 out of 10 times). If I turn on the power for the chip and use MCLR (switch it to high or low) the timer will work everytime on a MCLR reset. Is there anything that I need to clear in the software? I already reset the timer1 flag.

unsigned char t2=0;
unsigned char  t1=0;
unsigned char t0=0;
void main() {
//timer1 setting##########
T1IF_bit= 0;                     //clear flag
IEC0.T1IE         = 1;           //enable timer1 interrupt
IPC0=0b0100000000000000;         //priority
//###########

UART2_Init(115200);             //output something to computer

////////
T1CON.TON=1;  ///start timer1
////////
while(1){

UART_Write(t2);
UART_Write(t1);
UART_Write(t0);
}
}

T1IF_bit= 0;  //clear the flag
t0++;         //increment something
if(t0==255){t1++;}
if(t1==255){t2++;}
}

• When I load the same code to a new chip, the timer1 starts on POR 9 out of 10 times. – Timtianyang Feb 21 '13 at 19:15