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

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

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?


From: David Kelly
Subject: Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?
Date: Mon, 19 Sep 2005 20:22:57 -0500

On Mon, Sep 19, 2005 at 05:46:52PM +0200, Vincent Trouilliez wrote:

On Mon, 2005-09-19 at 07:33 -0500, David Kelly wrote:

Your putchar() (or whatever) writes to an LCD? So how long does it
take to latch a character into the LCD?

Yep I print to standard text LCD module (4x20), it takes about 45us
for the module to digest a character. 4 characters to send, that 0.2ms
maaaaximum. So they the LCD really can't be held responsible for the
6ms ;-)

OK, 0.2ms max to write one, but how long to write two? Once the data is
latched into the LCD it has to process and IIRC that is often 1 ms.

I guess most of the time is used doing divisions to convert the byte
in digits. But still, that would be 5,000++ cycles just to divide a
single byte by 100 then 10, sound a bit dear... there must be space
for further improvement ! :-)

Another way I thought to write the code without utoa()

in your first two functions you used utoi, which wasn't recognized by
the gcc, so I had to look in the avr-libc PDF to search for an
equivalent and picked up itoa instead. But maybe that wasn't the
best(fastest) choice ?


No, utoa() was correct. utoi() was a brain fart.

Ah, it contains the same line that makes the compiler fail on your
another_dot_two() :

strncpy_P( buffer, PGM_P("000"), 3 );

It says :

ui.c:65: error: parse error before "const"
make: *** [ui.o] Error 1

Heck, just pulled that function out of the Doxygen comments in
pgmspace.h. This may occupy less space and is sure to run faster:

    buffer[0] = buffer[1] = buffer[2] = '0';

Just to be safe (because I don't remember all the surrounding code):

    buffer[3] = 0;  // note lack of quotes around 0

--
David Kelly N4HHE, address@hidden
========================================================================
Whom computers would destroy, they must first drive mad.





reply via email to

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