This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Trying to generate nano seconds delay in LPC1768

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) */
}

0