View Single Post
Old 10-17-2016, 11:36 AM   #13 (permalink)
t vago
MPGuino Supporter
t vago's Avatar
Join Date: Oct 2010
Location: Cedar Rapids, IA
Posts: 1,766

The Karen-Mobile - '05 Dodge Magnum SXT
Team Dodge
90 day: 26.72 mpg (US)

Fiat Dakota - '00 Dodge Dakota SLT RWD Quad Cab
90 day: 16.67 mpg (US)

The Red Sled - '01 Dodge Durango SLT 4WD
90 day: 16.96 mpg (US)
Thanks: 799
Thanked 682 Times in 437 Posts
Originally Posted by skybolt View Post
No code with string 192, no easy math that maps to 19200 given 20/16MHz change, no identifiable myubbr string. **sigh**

There is a nice line
const unsigned int myubbr = (unsigned int)(processorSpeed * 625ul / 96ul - 1);
, but altering the 96 to any other multiple I can think of hasn't worked yet. I'm busy doing other things, so I haven't divided 625/96 or 96/625 but I will say then when it was compiled for 20MHz on a 16MHz microcontroller, data read properly at 19200 (or was it 9600?). Point is, the 16/20MHz change and relationship to 625 merits a quick run through a calculator. 625 is .625 which is 5/8 I believe, but 96 to 192 is a 1/2.
I think I may have oversimplified that myubbr calcuation. Here's what it should look like:

const unsigned int myubbr = (unsigned int)((processorSpeed * 62500ul / 9600ul) - 1);
With that line re-written as above, you should be able to replace '9600ul' with any legal baud rate that the Arduino can support.

I'll take a look at your other question when I get the time. Thanks again!
The Fiat Dakota

The Karen-mobile

The Red Sled
  Reply With Quote