From DataSheets
Baudrate = Fosc/(Fmult *(SPBRGRegister + 1))
therefore
SPBRGRegister + 1 =Fosc/(Fmult * Baudrate)
therefore
SPBRGRegister = (Fosc/(Fmult * Baudrate)) - 1
So
br300 to br115200 which goes into SPBRGRegister should be
br300 = Fosc/(Fmult * 300) - 1 + 0.5, // + 0.5 for rounding
ie no + 1 on the baudrates
Error in USART Module with Baudrate Constants
Moderators: David Barker, Jerry Messina
-
- Swordfish Developer
- Posts: 1473
- Joined: Fri Jan 30, 2009 6:27 pm
- Location: US
I could be completely wrong on this, but with the "+1" being in the divisor, it's not going to have much of an effect on the outcome considering the size of the numbers involved.
I don't have the patience to check, but perhaps there are certain combinations where it helps produce a "better" result, just like adding the 0.5 to round the result up does, I suppose.
But you're right...it doesn't match the datasheet calculation 100%. Whether it's a mistake or not, I couldn't tell you.
I don't have the patience to check, but perhaps there are certain combinations where it helps produce a "better" result, just like adding the 0.5 to round the result up does, I suppose.
But you're right...it doesn't match the datasheet calculation 100%. Whether it's a mistake or not, I couldn't tell you.