有的哦 就是在串口调试助手上显示不出来 为啥?
#include "msp430x54x.h"
void init_uart(void);
void init_clock(void);
/****************************************************************
串口发送字符串函数
****************************************************************/
void UartTX_Send(unsigned char *Data,int len)
{
int j;
for(j=0;j {
while (!(UCA1IFG&UCTXIFG));
UCA1TXBUF =*Data++;
}
}
void main(void)
{
unsigned char a[10]="hello";
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
init_clock();
init_uart();
// __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
UartTX_Send(a,5);
__no_operation();
}
void init_clock(void)
{
unsigned int i;
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P11DIR = BIT0+BIT1+BIT2; // P11.1-2 to output direction
P11SEL |= BIT0+BIT1+BIT2; // P11.1-2 to output SMCLK,MCLK
P5SEL |= 0x0C; // Port select XT2
UCSCTL6 &= ~XT2OFF; // Ena××e XT2 even if not used
UCSCTL3 |= SELREF_2; // FLLref = REFO
UCSCTL4 |= SELA__XT2CLK;//辅助系统时钟来源XT2-16M
UCSCTL4 |= SELS_5 + SELM_5; // SMCLK=MCLK=XT2-16M
_NOP();
UCSCTL5 |= DIVM__2 + DIVS__16+DIVA__16; //主系统时钟2分频-8M;子系统时钟16分频-1M;辅助系统时钟16分频1M
/*do
{
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);// Clear XT2,XT1,DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear fault flags
for(i=0;i