[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] integer overflow compiler warning?
From: |
Sander Pool |
Subject: |
Re: [avr-gcc-list] integer overflow compiler warning? |
Date: |
Tue, 31 Dec 2002 10:24:33 -0800 |
Thanks Klaus, Volkmar and Rune for your help. Dang, here I thought I was a
proficient c programmer and there I learn another beginners lesson today.
Now if only I could get my m128 board to accept ISP programming again (it
stopped for some mysterious reason) then I can get going again :-)
Thanks!
Sander
----- Original Message -----
From: "Klaus Rudolph" <address@hidden>
To: "Sander Pool" <address@hidden>; <address@hidden>
Sent: Tuesday, December 31, 2002 2:51 AM
Subject: Re: [avr-gcc-list] integer overflow compiler warning?
> > 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
>
avr-gcc-list at http://avr1.org