|
From: | Wouter van Gulik |
Subject: | Re: [avr-gcc-list] Problem with delay loop |
Date: | Fri, 28 Sep 2007 10:10:03 +0200 |
User-agent: | Thunderbird 2.0.0.6 (Windows/20070728) |
Royce Pereira schreef:
Hi all, In the latest WinAVR (avr-gcc (GCC) 4.1.2 (WinAVR 20070525) I found this. Check this out: //====================== void delay(unsigned del_cnt) { while(del_cnt--); return; } //=======================
Well writing your own delay_loops is not recommended, because the optimiser might optimise your loop away. Use <util/delay.h> instead.
Please note that delay.h might not work if compiling without optimiser (but then again, your loop will not be gone)
HTH, Wouter
[Prev in Thread] | Current Thread | [Next in Thread] |