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

Delay timing on ARM7 LPC2129 processor

Dear Friends,

I am using an ARM7 LPC2129 controller with 10~Mhz external oscillator. My controller is running at 60Mhz and PCLK at 30Mhz.

I have a quick question for you. I want to write a delay function this way:

void Delay (unsigned char DelayInMilliSec)
{ unsigned long Timing,Loop;

for(Loop=0;Loop<DelayInMilliSec;Loop++)

for(Timing=0;Timing<xxxxx;Timign++); //I want one milli Second delay here

}

What value should I keep in place of xxxxx to generate a one milli second delay. I donot want to use the timer functionality.
It will be ok using the NOP instruction, but please guide me what should be done to generate the one milli second delay in place of second for loop..

Thank you dudes in advance for the reply.

Parents
  • What you want and what you should may not always be the same thing.

    The answer is simple. You should not do a counted software delay.

    Configure a timer, read out the timer value and poll it until x ms have passed. This is trivial, and will not be affected by changes of compiler optimizations, changes of flash caching etc.

Reply
  • What you want and what you should may not always be the same thing.

    The answer is simple. You should not do a counted software delay.

    Configure a timer, read out the timer value and poll it until x ms have passed. This is trivial, and will not be affected by changes of compiler optimizations, changes of flash caching etc.

Children