problem with delay function

void Timer1Init(void)

_T1IP = 4; // this is the default value anyway
TMR1 = 0; // clear the timer
PR1 =0x0139 ;
T1CON = 0x8030;
_T1IF = 0;
_T1IE = 1;


void attribute((interrupt, no_auto_psv)) _T1Interrupt(void)

 LATAbits.LATA0 = ~LATAbits.LATA0;  //Toggle output to LED
_T1IF = 0;


void Timer2Init(void)

_T2IP = 4; // this is the default value anyway
TMR2 = 0; // clear the timer
PR2 = 0x1E85;
T2CON = 0x8030;
_T2IF = 0;


void attribute((interrupt, no_auto_psv)) _T2Interrupt(void)

 LATAbits.LATA1 = ~LATAbits.LATA1 ;
DELAY_MS (6000);
_T2IF = 0;


int main(void)

    TRISAbits.TRISA0 = 0;
TRISAbits.TRISA1 = 0;
ANSELA = 0x0000;
_RCDIV=0;

Timer1Init();
Timer2Init();
while (1)  {}


above written program is not working correctly i have given a delay in timer 2 interrupt routine that means there should be delay of 6s for led to blink connected to A1 pin and its working but the problem is that there is also a delay happening while blinking the led connected to pin A0 can anybody help me to tell whats wrong here ?

• Edit your text so we can see the code please. – Oldfart Mar 23 '18 at 7:40
• sorry i done it – chamanpreet singh Mar 23 '18 at 7:48
• Code is still unreadable. There is a code tag button on the editor toolbar. Use that, remove blank lines, indent properly and add comments. For the text of your post please use capital letters and punctuation. Read the post carefully before pressing the "Post Your Question" button. Your compiler won't let you away with it. Why should we? – Transistor Mar 23 '18 at 7:48
• Code formatting is still a mess after your edit. -1. – Transistor Mar 23 '18 at 10:44