avr-libc-dev
[Top][All Lists]
Advanced

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

[avr-libc-dev] [patch #5343] Add a util/setbaud.h "helper" file


From: Carlos Lamas
Subject: [avr-libc-dev] [patch #5343] Add a util/setbaud.h "helper" file
Date: Thu, 31 Aug 2006 16:25:35 +0000
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5

Follow-up Comment #3, patch #5343 (project avr-libc):

Hello,

There were overflow problems with baud rates lower than 32768 in C
expressions. I couldn't see the problem before because my F_CPU and BAUD were
defined long. This is solved in version 1.3 submitted by tacking UL at the end
of the constants involved to force the compiler to use long type arithmetics.
cpp expressions (#if's) are supposed to operate in 64 bit precision and they
shouldn't overflow for reasonable frequency and baud rate values.

The rounding errors were issued previously and they should not give different
results to hand calculated.

UBRR values delivered had the same error tolerance, 2% default. Obviously
when there was no overflow errors.

U2X=0 was always used when possible.

Anyway, I can't see advantages in using a "short" lookup table for this case
of so many possible F_CPU/BAUD combinations.

Carlos.

    _______________________________________________________

Additional Item Attachment:

File name: setbaud.h                      Size:4 KB
V1.3 header to set UBRR from given F_CPU/BAUD values
<http://savannah.nongnu.org/patch/download.php?file_id=10659>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?5343>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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