Designer III Blog (home)
New Comments Designer III Blog RSS Feed

Designer III Blog January Archive

Favorite Posts:
, :




FFF5D6,FFF5D6,FFF5D6,FFE699
Other Resources
FFF5D6,FFF5D6,FFF5D6,FFE699
Tags

Blog Roll:


avr baud rate Designer III Blog; January, 2009 Archive; Designer III Blog
Top Searches: • sound carts • discount av carts • prc100 oklahoma sound • free sound carts • sound carts • used av cart • tv stands sales in oklahoma • mahogony portable av carts • oklahoma sound presentation stand prc200 &ganizers-and-stands.html

Why is my AVR baud rate wrong?

By Bob Paddock at 01/11/09 20:13

Recent AVR-LibC FAQ submission of mine:

Why is my AVR baud rate wrong?

Some AVR datasheets give the following formula for calculating baud rates:

(F_CPU/(UART_BAUD_RATE*16L)-1)

Unfortunately that formula does not work with all combinations of clock speeds and baud rates due to integer truncation during the division operator.

When doing integer division it is usually better to round to the nearest integer, rather than to the lowest. To do this add 0.5 (i.e. half the value of the denominator) to the numerator before the division, resulting in the formula:

((F_CPU + UART_BAUD_RATE * 8L) / (UART_BAUD_RATE * 16L) - 1)

 


Tags: avr baud rate • interger truncation • round to nearest integer • avr libc •
0 Comments. - Permalink


avr baud rate Archives: • January, 2009



* com * top 100 * 10 * 1359 * Blog * Espanol *

Have you added a link to us from your website? (1359):

  • <a href="http://blog.designer-iii.com">Designer III Blog</a>
avr baud rate Designer III Blog; January, 2009 Archive; Designer III Blog

Web site copyright (c) 2007-2010 GLR Sales LLC.




(rozwqizwpwzpy)

Privacy & DMCA Policy -- Those who twitter us!
avr baud rate Designer III Blog January Archive