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.

带JTAG工作正常电池供电独立工作就不正常

Other Parts Discussed in Thread: MSP430F2619

试验了一下在带JTAG时串口助手接收正常,脱开JTAG用电源供电,电压正常稳定,但是接收就不正常了。什么问题啊?

试验代码如下:

#include <msp430f2619.h>
#define delay_us(us) __delay_cycles(8*us)
typedef unsigned char uchar;
typedef unsigned int uint;

void main(void)
{
uchar value = 0;

WDTCTL = WDTPW + WDTHOLD; 

__bis_SR_register(OSCOFF); //只有一个8MHz晶振
unsigned int i;
BCSCTL1 &= ~XT2OFF;
BCSCTL3 |= XT2S_2;
do
{
IFG1 &= ~OFIFG;
for (i = 0xFF; i > 0; i--);
}
while (IFG1 & OFIFG);
BCSCTL2 |= SELM_2 + SELS + DIVS_3;

P3SEL |= 0x30;                                                 // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSSEL_2;                              // CLK = SMCLK
UCA0BR0 = 0x68;                                            // 1MHz/9600 = 104.17
UCA0BR1 = 0x00;                                            //
UCA0MCTL = UCBRS1 + UCBRS0;              // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST;                          // **Initialize USCI state machine**
IE2 |= UCA0RXIE;                                          // Enable USCI_A0 RX interrupt
_EINT();

while(1)

{
while (!(IFG2&UCA0TXIFG));                           // USCI_A0 TX buffer ready?
UCA0TXBUF = value;
value++;
value &= 0x7f;                                                  // ??value?????128
delay_us(500);
}

}

#pragma vector=USCIAB0RX_VECTOR
__interrupt void usart0_rx (void)
{
while (!(IFG2 & UCA0TXIFG));                       // USART0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF;                       // RXBUF0 to TXBUF0
}