I usually do this if I need a single cycle delay:
asm("nop");
Be careful if you need to do it multipe times as it will be optimized and
the results may be unexpected (assuming you are using optimization).
There is also:
__builtin_avr_delay_cycles(unsigned long __n);
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.
On Sun, Jan 29, 2012 at 6:23 PM, Britton Kerin <[email protected]>wrote:
> I notice the AVR Libc include/compat/ina90.h has this:
>
> #define _NOP() do { __asm__ __volatile__ ("nop"); } while (0)
>
> but I didn't find anything else "nop"ish. I generally don't include
> ina90.h.
> Is there some good concise GCC/AVRLibc way to write nop that I missed?
>
> Thanks,
> Britton
>
> _______________________________________________
> AVR-chat mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/avr-chat
>
_______________________________________________
AVR-chat mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-chat