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

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

Re: [avr-gcc-list] (Newbie)2.Delay function not working as required


From: Alexei Chetroi
Subject: Re: [avr-gcc-list] (Newbie)2.Delay function not working as required
Date: Thu, 8 Dec 2005 16:12:05 +0200
User-agent: Mutt/1.5.9i

On Thu, Dec 08, 2005 at 12:29:56PM +0000, Sumeet Pal Singh wrote:
> Date: Thu, 8 Dec 2005 12:29:56 +0000
> From: Sumeet Pal Singh <address@hidden>
> Subject: Re: [avr-gcc-list] (Newbie)2.Delay function not working as required
> 
>    The delay function is the regular one from <avr/delay.h>
>    I havce not written the delay.
> 
>    the thing is that
>    delayma(100);
>    delayma(100);
>    //Write this 100 times
>    gives a delay of 100*100ms.
> 
>    but
> 
>    for(char i=0;i<100;i++)
>    delayma(100);
> 
>    does not, that is where the problem is coming.

  I think that compiler optimize your cycle away, since variable i is
not used in its body. Whether turn off optimization or use application
note avr133 aproach.

  Try to check with "avr-objdump -h -S program.elf" to see what is actually
happening.

  Best wishes

--
Alexei Chetroi

Smile... Tomorrow will be worse. (c) Murphy's Law




reply via email to

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