| 
 
| 用f4152进行串口调试,观察寄存器可以看到UCA0TXBUF有数据,但串口调试助手一直没有显示,用的RS485串口,以下是程序,求高手指教#include <msp430x41x2.h> const char string1[] = { "Hello World\r\n" };
 unsigned int j = 0;
 
 void main(void)
 {
 volatile unsigned int i;
 
 WDTCTL = WDTPW+WDTHOLD;                   // Stop WDT
 UCA0CTL1 |= UCSWRST;
 UCA0CTL0 = 0;
 FLL_CTL0 |= XCAP11PF;                     // Configure load caps
 
 do
 {
 IFG1 &= ~OFIFG;                         // Clear OSCFault flag
 for (i = 0x47FF; i > 0; i--);           // Time for flag to set
 }
 while ((IFG1 & OFIFG));                   // OSCFault flag still set?
 
 P6SEL |= BIT5+BIT6;                       // P6.5,6 = USCI_A0 RXD/TXD
 
 P6DIR &=~BIT5;
 P6DIR |= BIT6;
 
 UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK
 UCA0BR0 = 0x03;                           // 32k/9600 - 3.41
 UCA0BR1 = 0x00;                           //
 UCA0MCTL = UCBRS1 + UCBRS0;                          // Modulation
 UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
 IE2 |= UCA0TXIE;                          // Enable USCI_A0 RX interrupt
 //  ME2 |= UCA0RXE;
 while(1)
 {
 while(!(IFG2&UCA0TXIFG));
 UCA0TXBUF = 'A';
 for (i = 0x500; i > 0; i--);
 }
 
 //  _EINT();
 //  __bis_SR_register(LPM3_bits + GIE);                  // Enter LPM0, interrupts enabled
 }
 
 #pragma vector=USCIAB0TX_VECTOR
 __interrupt void USCI0TX_ISR(void)
 {
 UCA0TXBUF = string1[j++];                 // TX next character
 
 if (j == sizeof string1 - 1)              // TX over?
 {
 IE2 &= ~UCA0TXIE;                       // Disable USCI_A0 TX interrupt
 IE2 |= UCA0RXIE;
 }
 }
 
 #pragma vector=USCIAB0RX_VECTOR
 __interrupt void USCI0RX_ISR(void)
 {
 if (UCA0RXBUF == 'u')                     // 'u' received?
 {
 j = 0;
 IE2 |= UCA0TXIE;                        // Enable USCI_A0 TX interrupt
 UCA0TXBUF = string1[j++];
 }
 }
 
 因为之前调试一直无反应,所以先把中断关了,只看发送是否可以发出,但结果却一直是观察寄存器可以看到UCA0TXBUF有数据,但串口调试助手没有显示
 | 
 |