430F149程序调试通过,直接编译下载即可功能:1串口通信+定时器A,2、可用串口1,2收发数据,3、波特率可改,定时器可改。以下是部分代码:void Init_TimerA(void){ TACTL = TASSEL0 +TACLR;//+ID1+ID0+TAIE; // ACLK, clear TAR,8分频 921.6kHZ CCTL0 = CCIE; // CCR0 interrupt enabled CCR0=3072; // 定时3ms TACTL |=MC0; // TACTL =~MC1;}void InitPort1 (void){ UCTL0 = CHAR; // 8-bit character UTCTL0 = SSEL0; // UCLK = ACLK UBR00 = 0x80; // 1.8432MMhz/57600 - 32 UBR10 = 0x00; // UMCTL0 = 0x00; // no modulation ME1 |= UTXE0 + URXE0; // Enable USART0 TXD/RXD IE1 |= URXIE0; // Enable USART0 RX interrupt P3SEL |= 0x30; // P3.4,5 = USART0 TXD/RXD P3DIR |= 0x10; // P3.4 output direction///////////////////////////1port // UCTL1 = SWRST; // UART 复位 BCSCTL1 |=XTS; //ACLK = LFXT1 = HF XTAL UCTL1 = CHAR; // 8-bit character UTCTL1 = SSEL0;//+URXSE; // UCLK = ACLK// UBR01 = 0x80; //使用7.3728M晶振时,波特率为57600bps // UBR11 = 0x00; UBR01 = 0x80; // 7.3728MMhz/57600 - 128 UBR11 = 0x00; // UMCTL1 = 0x00; //位调整 ME2 |= UTXE1 + URXE1; // Enable USART0 TXD/RXD // UCTL1 = ~SWRST; // UART 运行 // IE2 |= URXIE1; // Enable USART1 RX interrupt P3SEL |= 0xc0; // P3.6 = USART1 TXD P3DIR |= 0x40; // P3.6 output direction P3OUT = 0xff;} ……