avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] portable no-op with AVR GCC, AVR LIbc?


From: Weddington, Eric
Subject: Re: [avr-chat] portable no-op with AVR GCC, AVR LIbc?
Date: Sun, 29 Jan 2012 21:00:14 -0700


> -----Original Message-----
> From: address@hidden
[mailto:avr-chat-
> address@hidden On Behalf Of Anthony
Andriano
> Sent: Sunday, January 29, 2012 6:55 PM
> To: Britton Kerin
> Cc: address@hidden
> Subject: Re: [avr-chat] portable no-op with AVR GCC, AVR LIbc?
> 
> There is also:
> 
> __builtin_avr_delay_cycles(unsigned long __n);


This is the preferred method.
 
> The compiler will delay exactly as many cycles as you provide with the
> argument by inserting useless, and more importantly harmless, code. I
usually
> see something like a string of subtracts, adds, etc.

It should be "NOP" or "RJMP ." (which delays 2 cycles but just jumps to
the next instruction), and then typically loops formed around those
instructions to delay to the exact number of cycles.

Eric Weddington



reply via email to

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