void init_uart1(void)
{
P5SEL |= 0xC0; // P5.6,7 = USCI_A1 TXD/RXD
UCA1CTL0 |= 0X80; //odd parity
UCA1CTL1 |= UCSWRST; // **Put state machine in reset**
UCA1CTL1 |= 0X40; // ACLK
UCA1BR0 = 0x03; // 1MHz 115200 (see User's Guide)
UCA1BR1 = 0x00; // 1MHz 115200
UCA1MCTL |= UCBRS_3+UCBRF_0; // Modulation UCBRSx=1, UCBRFx=0
UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA1IE |= UCRXIE; // Enable USCI_A1 RX interr
//__bis_SR_register(GIE); // 使能中断
//_EINT();
}
串口初始化的时候为什么只打开接收中断使能,而不能打开发送中断使能?一代开就出错
此帖出自
小平头技术问答
一周热门 更多>