baud calculator

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi
i wounder wath baud value i should use with a 32mhz xmega usally i do this with bascom avr baud calculator but it does only goes up to 22mhz and i don't now how to do this
manual.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it is in the datasheet, look at page 238 in the manual. There is a table titled "Equations for Calculating Baud Rate Register Setting.

The equation is slightly different than that of the traditional AVR's due to a prescaler being present, before the baud rate divisor.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try this calculator instead.

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If bascom don't calculate constant expressions at compile time, then you should chose a programming language, which can do it, e.g. C.

Then simple write down the formula for the baud rate divider and insert your crystal and the wanted baud rate:

#define XTAL 14.756e6
#define BAUD 9600
#define BDIV (uint16_t)(XTAL / BAUD / 16 - 0.5) )

 UBRR0H = BDIV >> 8;
 UBRR0L = BDIV & 0xFF;

I use only ATtiny/ATmega, maybe the formula was different for Xmega.

No need for awkward separate calculator tools.

Peter

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks glitch it is not so fun to read 445 pages and of some reasons the bokmarks doesn't work on my computer dam crap!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

danni: the formula for the XMEGA is similar, but it has an extra parameter BSCALE.

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are running at 32MHz, you do not need the BSCALE (at least for normal baud rates)