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

为什么官方的历程初始化UART要选择低功耗模式,

$
0
0
void UART_init(void)
{
   P3SEL = BIT3+BIT4;                        // 配置IO口复用P3.4,5 = USCI_A0 TXD/RXD
  UCA0CTL1 |= UCSWRST;                      // **Put state machine in reset**
  UCA0CTL1 |= UCSSEL_2;                     // 选择时钟源SMCLK
 /* UCA0BR0 = 6;                              // 1MHz 9600 (see User's Guide)
  UCA0BR1 = 0;                              // 1MHz 9600
  UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16;   // Modln UCBRSx=0, UCBRFx=0,*/
   UCA0BR0 = 78;                              // 1MHz 9600 (see User's Guide)
  UCA0BR1 = 0;                              // 1MHz 9600
  UCA0MCTL = UCBRS_0 + UCBRF_2 + UCOS16;   // Modln UCBRSx=0, UCBRFx=0,
                                            // over sampling
  UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
  UCA0IE |= UCRXIE;                         // Enable USCI_A0 RX interrupt
//__enable_interrupt();
  //__bis_SR_register(LPM0_bits + GIE);       // Enter LPM0, interrupts enabled
__bis_SR_register(LPM0_bits + GIE);       // Enter LPM0, interrupts enabled
//__low_power_mode_off_on_exit();
  __no_operation();                         // For debugger
}

我自己用__enable_interrupt()开启中断没有开启低功耗发送会来的数据就乱码了,可是低功耗的时候进入不了主函数求教!

嘤嘤嘤


Viewing all articles
Browse latest Browse all 3634

Trending Articles