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.

msp430G2755串口通信问题

Other Parts Discussed in Thread: MSP430G2755

#include "msp430g2755.h"

void Init_uart0()
{
UCA0CTL1|=UCSWRST;
UCA0CTL0&=~UC7BIT;//字符长度为8
UCA0CTL1|= UCSSEL_2; //选择时钟
UCA0BR0=0x6D; //波特率为9600
UCA0BR1=0x00;
UCA0MCTL=0x00; //UCA0MCTL=UCBRS0;
IE2=UCA0RXIE+UCA0TXIE;//开接收使能
UCA0CTL1&= ~UCSWRST;


// P1SEL|=BIT1+BIT2; //将P1.1 P1.2设为第二功能 //2553可用
// P1SEL2|=BIT1+BIT2;

P3SEL|=BIT4+BIT5; //将P3.4 P3.5设为第二功能 //2755用
P3SEL2|=BIT4+BIT5;
}

void Uart0Sends(char *s)
{
while(*s!='\0')
{
UCA0TXBUF=*s;
while((IFG2&UCA0TXIFG)==0); //查询发送是否结束
IFG2&=~UCA0TXIFG; //清除发送一标志位
s++;
}
}

void main( )
{
int i;
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
Init_uart0();
_EINT();
while(1)
{
for(i=0;i<128;i++)
{
Uart0Sends(p[i]);
__delay_cycles (1048576);
}
}
}

先贴一段程序。如注释所说,注释掉2755那行,2553就可以向串口发送数据了。但是注释掉2553那行,2755无法向串口发数据。

我想问下是不是两者时序有什么不同呢?寄存器差不多啊