« Return to Thread: Problem with delay loop

Problem with delay loop

by Royce Pereira :: Rate this Message:

| View in Thread

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/
_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@...
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

 « Return to Thread: Problem with delay loop