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

'Why is my AVR baud rate wrong?'

Favorite Posts:
, :




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

Previous Posts

Blog Roll:


news Why is my AVR baud rate wrong?; 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
Previous (Newer) PostNext (Older) Post

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)

 

News Digest Blog
Tags: • - Permalink
Previous (Newer) PostNext (Older) Post

Comments
Leave a comment:

We welcome your comments on this post in the Designer III Blog. That means a comment on this post, not something about some other topic.

Name:     (required)
Email:    (required, not published)
Comment:
         


Note: Your comment will be immediately submitted and you will have no opportunity to review to edit it.

It is recommend that you register on Designer III Blog and login so you can include full html (ie: links). We don't have a chapta because we think we're smarter than the spambots.



20090111-201356-Why-is-my-AVR-baud-rate-wrong

* com * top 100 * 10 * 4861 * Blog * Espanol *

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

  • <a href="http://blog.designer-iii.com">Designer III Blog</a>
news Why is my AVR baud rate wrong?; Designer III Blog

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




(rozwqizwpwzpp)

Privacy & DMCA Policy -- Those who twitter us!
20090111-201356-Why-is-my-AVR-baud-rate-wrong avr baud rate 'Why is my AVR baud rate wrong?'