Error generating 1 sec delay using timers in PIC32
I finally designed a logic using timers which is giving me 1ms delay:
#define FCY 72000000L
#define FPB 36000000L
#pragma config POSCMOD=XT, FNOSC=PRIPLL
#pragma config FPLLIDIV=DIV_2, FPLLMUL=MUL_18, FPLLODIV=DIV_1
#pragma config FPBDIV=DIV_2, FWDTEN=OFF, CP=OFF, BWP=OFF
void Delayms( unsigned t)
{
T1CON = 0x8000;
while (t--)
{
TMR1 = 0;
while (TMR1 < FPB/1000);
}
}