avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] avr-libc _delay routines


From: Micah Carrick
Subject: [avr-gcc-list] avr-libc _delay routines
Date: Fri, 12 May 2006 09:11:20 -0700
User-agent: Thunderbird 1.5.0.2 (X11/20060501)

I noticed that a lot of code out there has a function something like this:

void delayms(uint16_t millis) {
 uint16_t loop;
 while ( millis ) {
   _delay_ms(1);
   millis--;
 }
}

Is this function used because of the limitation of _delay_ms()? I read that it's max is "The maximal possible delay is 262.14 ms / F_CPU in MHz." Does that mean that at 8 MHz, the max delay is 32 mS? And that's where that other routine comes in? Wouldn't the function above actually delay longer than millis mS since the while and declaration take up clock cycles?

- Micah






reply via email to

[Prev in Thread] Current Thread [Next in Thread]