Designer III Blog (home) Designer III Blog RSS Feed

Designer III Blog January Archive

Favorite Posts:
, :
##OFC##



(Login / Register)



Advertisement:
Free promotion



FFF5D6,FFF5D6,FFF5D6,FFE699
Tags

Blog Roll:


avr baud rate Designer III Blog; January, 2009 Archive; Designer III Blog
  • -- ../../local/design/avr_baud_rate

    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 * 3746260150 * Blog * Espanol *

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

    • <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-2011 GLR Sales LLC.



    (rozwqizwipzerw)

    Privacy & DMCA Policy
    avr baud rate Designer III Blog January Archive