Quantcast
Channel: MSP 低功耗微控制器论坛 - 最近的话题
Viewing all articles
Browse latest Browse all 3634

MSP430F5XX系列单片机UART中断开关的问题。

$
0
0

以下是我使用UARTA0初始化和打开中断的程序,我想在后面一段时间内关断该中断再打开,应该如何写写代码啊

P3SEL |= (BIT4+BIT5); // P3.4,P3.5分别配置为Port TXD1和Port RXD1
UCA0CTL1 |= UCSWRST; // 软件复位
UCA0CTL1 |= UCSSEL_2; // 选择SMCLK时钟 ,需要将SMCLK时钟频率设置为16MHz

//波特率设置成115200
UCA0BR0 = 138; // 查表获得
UCA0BR1 = 0; // UCA0BRX和UCA0MCTL数值 UCA0BRX=UCA0BR0+UCA0BR1*256
UCA0MCTL |= UCBRS_7 + UCBRF_0; // 将波特率设置为115200

UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // 使能接收中断

  __bis_SR_register(GIE);       // enable interrupts


Viewing all articles
Browse latest Browse all 3634

Trending Articles