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

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

Re: [avr-gcc-list] generating a delay


From: Daniel O'Connor
Subject: Re: [avr-gcc-list] generating a delay
Date: Mon, 24 Oct 2005 17:21:13 +0930
User-agent: KMail/1.8.2

On Mon, 24 Oct 2005 16:37, varsha wrote:
> Hello all,
> I'm working on avr-gcc (GCC) 3.4.3
> Atmega 16 controller, clock frequecy is 8 MHz,
> and i want to generate a delay of 25ms.
> and i wrote one routine for the same..
> and called it in other function as
> delay(250,0xff);
..
>  what is the proper way to write a delay routine?

You should tell the compiler that i & j are volatile otherwise it will 
optimise your loop out of existance because it has no effects.

If you want a nice an accurate delay loop you should write it in assembly.

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C

Attachment: pgpsYwfOGrukU.pgp
Description: PGP signature


reply via email to

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