What divider should I use for a Baud Rate of 4800 when using
What divider should I use for a Baud Rate of 4800, when using a clock with 32768Hz? How would you set the UART registers: UxBR0, UxBR1, UxMCTL? • What is the data transfer rate?
Solution
Given that, Baud Rate = 4800, Clock = 32768 Hz
Divider = Clock/Baud Rate = 32768/4800 = 6.8266 (~7)
So, Divider is used for our case
The key registers for UART are UxBR1 (baudrate MSW), UxBR0 (baudrate LSW) and UxMCTL(modulation register)
In the divider calculation above, integer part represents UxBR and fractional part is used for UxMCTL.
Integer part is 6 i.e. UxBR(16-bit) = UxBR1 + UxBR0 = 06 => UxBR1 = 0(msw) and UxBR0 = 6(lsw)
For UxCMTL, fractional part is 0.8266. 0.8266 x n(no. of bits = 11) ~ 9. For <13 bits, UxMCTL should be is set with 0xFB.
Data transfer rate = baudrate*3.32log(2^no. of bits per character) = 4800*3.32log(2^9) = 43174 bits/sec
