This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2533 UART接收不了

Other Parts Discussed in Thread: MSP430G2533

大家好!

 我是新手!我在MSP430G2533中应该Ti官方例程序附下://******************************************************************************

//   MSP430G2xx3 Demo - USCI_A0, 9600 UART Echo ISR, DCO SMCLK

//

//   Description: Echo a received character, RX ISR used. Normal mode is LPM0.

//   USCI_A0 RX interrupt triggers TX Echo.

//   Baud rate divider with 1MHz = 1MHz/9600 = ~104.2

//   ACLK = n/a, MCLK = SMCLK = CALxxx_1MHZ = 1MHz

//

//                MSP430G2xx3

//             -----------------

//         /|\|              XIN|-

//          | |                 |

//          --|RST          XOUT|-

//            |                 |

//            |     P1.2/UCA0TXD|------------>

//            |                 | 9600 - 8N1

//            |     P1.1/UCA0RXD|<------------

//

//   D. Dang

//   Texas Instruments Inc.

//   February 2011

//   Built with CCS Version 4.2.0 and IAR Embedded Workbench Version: 5.10

//******************************************************************************

#include  "msp430g2533.h"

void main(void)

{

WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT

P1DIR = 0xFF;                             // All P1.x outputs

P1OUT = 0;                                // All P1.x reset

P2DIR = 0xFF;                             // All P2.x outputs

P2OUT = 0;                                // All P2.x reset

P1SEL = BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD

P1SEL2= BIT1 + BIT2 ;                     // P1.1 = RXD, P1.2=TXD

P3DIR = 0xFF;                             // All P3.x outputs

P3OUT = 0;                                // All P3.x reset

UCA0CTL1 |= UCSSEL_1;                     // CLK = ACLK

UCA0BR0 = 0x03;                           // 32kHz/9600 = 3.41

UCA0BR1 = 0x00;                           //

UCA0MCTL = UCBRS1 + UCBRS0;               // Modulation UCBRSx = 3

UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**

IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt

__bis_SR_register(LPM3_bits + GIE);       // Enter LPM3, interrupts enabled

}

// Echo back RXed character, confirm TX buffer is ready first

#pragma vector=USCIAB0RX_VECTOR

__interrupt void USCI0RX_ISR(void)

{

while (!(IFG2&UCA0TXIFG));                 // USCI_A0 TX buffer ready?

UCA0TXBUF = UCA0RXBUF;                     // TX -> RXed character

}

我在开发板上运行,在超级终端上输入字符程序却接收不到。请高手指点。(在开发板上运行定时器A模拟串口的例程是能收能发的!)