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: Vincent Trouilliez
Subject: Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?
Date: Mon, 19 Sep 2005 02:58:05 +0200

> The only alternative is:
> printf ("%d.%03d", x / 1000, x % 1000)
> 
> I don't know the capabilities of avr libc, I hope it copes with the 
> leading zero format.

Just tested it...

int main (void){
unsigned int value;

        value = 6874;
        while (TRUE) {

                lcd_goto_rc(1,1); //display number in top left corner
                PORTD = ~PORTD; //toggle port pins
                printf ("%d.%03d", value / 1000, value % 1000);
                PORTD = ~PORTD;
                _delay_ms(50);
        }
}


...compiles and runs fine, but my scope timed it at no less than
13ms !!!!  I am running on the on-chip 1MHz RC oscillator, so that's
about 13,000 machine cycles then, ouch !


--
Vince





reply via email to

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