[Top][All Lists]

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

Re: [avr-libc-dev] poor optimisation

From: Rob Ward
Subject: Re: [avr-libc-dev] poor optimisation
Date: Tue, 19 Nov 2002 15:08:51 +1300
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826

Hi Joerg. Thanks for your comments and the link. Two points...

1. Using you 'loop code' would almost definitely make the generated code smaller, however in this case speed is most important. The way I have written the code has in fact saved about 13 microseconds within the ISR. This is important in this application.

2. A faster / better version could be...

SetDataLow(); if (DataHigh & 0x80) SetDataHigh(); SetClockHigh(); SetClockLow();

which has no jusp instructions, and which compiles to...

SetDataLow(); if (DataHigh & 0x80) SetDataHigh(); SetClockHigh(); SetClockLow();
 62:    c0 98           cbi    0x18, 0    ; 24
 64:    97 fd           sbrc    r25, 7
 66:    c0 9a           sbi    0x18, 0    ; 24
 68:    97 9a           sbi    0x12, 7    ; 18
 6a:    97 98           cbi    0x12, 7    ; 18

which in my case also saves about another 80 bytes of ROM space and should make things faster again.

Thanks for the help.


reply via email to

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