Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Per Westermark
03/02/12 06:02
Read: 389 times
Sweden


 
#186356 - Delay
Responding to: Per Westermark's previous message
By the way - spend some time picking up the wibes on using a busy-loop as delay:
void delay(unsigned int ms) {
    unsigned char n;
    unsigned int i;
    for(n=0;n<ms;n++) {
        for(i=0;i<count;i++) ;
    }
}

Exactly how do you know this function really gives a delay of "ms" milliseconds?
Why not use a delay that base the delay time on real, clocked hardware - like for example a hw timer? Wouldn't it be a huge advantage if the delay isn't greatly changed by compiler version or compiler options?

List of 7 messages in thread
TopicAuthorDate
Help me      Daud Shakil      03/02/12 05:15      
   Descriptive?      Per Westermark      03/02/12 05:54      
      Delay      Per Westermark      03/02/12 06:02      
         Why loop with char for int parameter?      Per Westermark      03/02/12 06:08      
   Tips      Satish S Munot      03/02/12 05:57      
      Satish, you're not helping yourself here ...      Richard Erlacher      03/02/12 07:02      
         is this the "helping yourself" you refer to?      Erik Malund      03/02/12 07:36      

Back to Subject List