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: the baud rate clock source frequency = 8MHz, the required baud rate = 115200, then the baud rate parameters UxBR0, UxBR1 are 8000KHz/115.2KHz = 69.444444444, which is rounded to 69. The decimal part 0.444444444 is used as the parameter in the trimming register, and is calculated using the following formula: Baud rate trimming parameter (UxMCTL) = 8 x decimal part (take the integer part of the result) So, it should be 8 x 0.444444444=3.5, so we can take 3 or 4 here, here we take 4. Therefore, 4 pulse interpolation bits are required. In the UxMCTL register, after selecting 4 bits at random, UxMCTL=0x55. Note that the interpolation pulses should be dispersed among the 8 bits of UxMCTL as much as possible. At this point, the serial port baud rate parameter setting is completed.