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

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

Re: [avr-gcc-list] integer overflow compiler warning?


From: Klaus Rudolph
Subject: Re: [avr-gcc-list] integer overflow compiler warning?
Date: Tue, 31 Dec 2002 11:51:59 +0100

> In any case, the formula in the datasheet works out to be:
> 
> UBR = ((Fck/BR)/16) - 1
> 
> I plug in my values, 4 MHz and 9600 baud and UBR has to be set to 25. The
> same as shown in the table on page 74.
> 
> So I change my code to be like this:
> 
> #define F_CPU            4000000      /* 4Mhz */
> #define UART_BAUD_RATE      9600      /* 9600 baud */
Simply set 9600 -> 9600l !!!

this works for me. The calculation of BR*16 is bigger then int so make
it
long and your code will work. I never saw that problem before your
mail, thanks for that misterious art :-)

Bye
        Klaus
avr-gcc-list at http://avr1.org



reply via email to

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