TI MSP430 series microcontroller serial communication baud rate calculation method[Copy link]
TI MSP430 series microcontroller, the baud rate value of the usart module is determined by the following three registers: UxBR0, UxBR1, UxMCTL Baud rate = BRCLK/N, mainly to calculate N. BRCLK: clock source, which can be set as the clock source through the register; through the SSEL two bits of the register UCAxCTL1, 01: ACLK, 02: SMCLK N: The frequency division factor generated by the baud rate. N=UxBR1+UxBR0+UxMCTL, where UxBR1+UxBR0 is the integer part, UxMCTL is the set decimal part, where UxBR1 is the high bit, UxBR0 is the low bit, and the two are combined into a 16-bit word. For example: baud rate = 115200, clock source = 8MHz, external crystal oscillator N = 8000000/115200 = 69.44. Obviously: UxBR1 + UxBR0 = 69, that is, UxBR1 = 0, UxBR0 = 0x45, first round the decimal part 0.44 × 8, that is, 3.52, to 3. This 3 means that there must be 3 1s in the 8 bits in UxMCTL, and UxMCTL is divided into First Stage Modulation and Second Stage Modulation, that is, the former is the upper 4 bits, with a value range of 0-F, and the latter is the lower 4 bits. Note that the latter 4 bits are preferably even numbers. The rounded value of the decimal part obtained in the previous step is distributed to the high and low bits, such as 3, which can be written as 0x16.