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

time delay calculations

Dear All,

I am used to program ARM7 LPC2148 IC by Keil (Version -4) in 12 MHz, pls find the below delay,

So fro that how can i Calculate the time delay (used by 12MHz in Keil software).

void delay_1()
{ int d,d1; for(d1=0;d1<100;d1++) for(d=0;d<65000;d++);
}

Parents
  • Software delay loops like this are notoriously awful. Is there ANY way you can use some hardware timer, or clocking register??

    Use volatile keyword, tends to preclude the optimizer removing code. If you want to calibrate your routine, toggle a GPIO and measure with a scope, or aforementioned timer. This is a job for you, not the forum.

Reply
  • Software delay loops like this are notoriously awful. Is there ANY way you can use some hardware timer, or clocking register??

    Use volatile keyword, tends to preclude the optimizer removing code. If you want to calibrate your routine, toggle a GPIO and measure with a scope, or aforementioned timer. This is a job for you, not the forum.

Children
No data