msp430f5529单片机初始化代码配置uart波特率为115200
以下是msp430f5529单片机初始化代码,配置uart波特率为115200:
#include <msp430.h>
void init_UART(void);
int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer init_UART(); // initialize UART
while(1) {
// main program loop
}
}
void init_UART(void) { P3SEL |= BIT3+BIT4; // P3.3, P3.4 for UART UCA0CTL1 |= UCSWRST; // reset UART UCA0CTL1 |= UCSSEL_2; // SMCLK as clock source UCA0BR0 = 8; // 115200 baud rate UCA0BR1 = 0; UCA0MCTL = UCBRS_6 + UCBRF_0; // modulation control settings UCA0CTL1 &= ~UCSWRST; // release UART
原文地址: https://www.cveoy.top/t/topic/fcos 著作权归作者所有。请勿转载和采集!