Calculation and setting of baud rate of msp430 microcontroller[Copy link]
By setting three baud rate related registers, namely the baud rate integer UxBR1, UxBR0, and the baud rate trim register UxMCTL, the baud rate control parameters are calculated using the following formula: Baud rate parameter (UxBR0, UxBR1) = baud rate clock source frequency/required baud rate. (Take the integer part of the result) For example: baud rate clock source frequency = 8MHz, required baud rate = 115200, then baud rate parameters UxBR0, UxBR1 are 8000KHz/115.2KHz = 69.444444444, rounded to 69, the decimal part 0.444444444 is used as the parameter in the trim register, calculated using the following formula: Baud rate trimming parameter (UxMCTL) = 8 x decimal part (take the integer part of the result) Then, it should be 8 x 0.444444444 = 3.5, so here you can take 3 or 4, here take 4. Therefore, 4 pulse interpolation bits are required. In the UxMCTL register, after arbitrarily selecting 4 bits, UxMCTL = 0x55. Note that the interpolation pulses should be dispersed into the 8 bits of UxMCTL as much as possible. At this point, the serial port baud rate parameter settings are complete.