We are trying to develop the nano seconds delay but ended up with 1 us delay minimum.
init_timer()
{
LPC_SC->PCONP |= (1<<SBIT_TIMER0) | (1<<SBIT_TIMER1); /* Power ON Timer0,1 */
LPC_TIM0->MCR = (1<<SBIT_MR0I) | (1<<SBIT_MR0R); /* Clear TC on MR0 match and Generate Interrupt*/LPC_TIM0->PR = 0;//LPC_TIM0->MR0 = 10;//LPC_TIM0->TCR = (1 <<SBIT_CNTEN); /* Start timer by setting the Counter Enable*/NVIC_EnableIRQ(TIMER0_IRQn);
}
void TIMER0_IRQHandler(void){unsigned int isrMask;
isrMask = LPC_TIM0->IR;LPC_TIM0->IR = isrMask; /* Clear the Interrupt Bit */
LPC_GPIO0->FIOPIN ^= (1<<LED1); /* Toggle the LED1 (P2_0) */}