[Top][All Lists]

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

Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte

From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege
Date: Sat, 05 Nov 2005 01:18:38 +0100

> The bug is almost certainly a delay loop variable that is not declared
> volatile.  The delay function is probably something like:
> void shortDelay(void) {
>     uint8_t n = 50;
>     while (n--);
> }

Correct :-)
actually I did'nt even make it a function, as I use it only in one
place, the routine the send the character to LCD and waits 40us for the
LCD to process it.
I delcared the loop counter volatile and that indeed fixed it, thanks !
I can now enjoy the massive shrinking (13KB+ down to 10KB !) of the -Os
flag :o)

> Note that it will not give you precise control of your delay - different 
> optomisations or
> different compiler versions might give slightly different code, and may or
> may not inline the function.  But in a case like this it doesn't matter -
> all you are looking for is a slight delay, and it doesn't matter if it is
> too long.

That's it... minimum delay is about 40us, but the actual delay is
completely irrelevant, as long as it doesn't take an hour to print a
But well, admittedly, it's only a work around, and no real substitue for
proper polling of the busy flag. But that will keep me going until all
else is sorted, and I can get round to wiring the R/W line and updating
the LCD routines....  Okay, should take under 15 minutes door to door,
but well, I think I am just lazy today ;-) 


reply via email to

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