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

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

[avr-gcc-list] Problem with delay loop


From: Royce Pereira
Subject: [avr-gcc-list] Problem with delay loop
Date: Fri, 28 Sep 2007 13:25:38 +0530
User-agent: Opera Mail/9.22 (Win32)

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;
    }
//=======================

Compiles as (from the .lss file):

//=======================
void delay(word cnt)
    {
  2aa:  08 95           ret

       while(cnt--);

       return;
    }
//=======================

The loop is not executed !!

Where as in an older version (WinAVR-20060421)

It compiles correctly as:
//==========================================
void delay(word cnt)
    {
       while(cnt--);
  286:  01 97           sbiw    r24, 0x01       ; 1
  288:  2f ef           ldi     r18, 0xFF       ; 255
  28a:  8f 3f           cpi     r24, 0xFF       ; 255
  28c:  92 07           cpc     r25, r18
  28e:  d9 f7           brne    .-10            ; 0x286 <delay>
  290:  08 95           ret


       return;
    }
//=======================================

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

reply via email to

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