|
现在受到的都是0,
请看程序:
#include <msp430x44x.h>
void Init(void);
char Data[6]={0x01,0x02,0x03,0x04,0x05,0x06};
void main(void)
{
unsigned char i,j;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
Init();
while(1)
{
TXBUF0=0x01;
while((UTCTL0&0x01) == 0);
for(i=0;i<=6;i++)
{
TXBUF0=Data[i];
while((UTCTL0&0x01) == 0);
}
}
}
void Init(void)
{
ME1 |= 0x20; // Ena××e USART0 TXD/RXD
UCTL0 |= 0x10; // 8-bit character
UTCTL0 |= 0x10; // UCLK = ACLK
UBR00 = 0x03; // 32k/9600 - 3.41
UBR10 = 0x00; //
UMCTL0 = 0x4A; // Modulation
UCTL0 &=~SWRST; // Initialize USART state machine
P2SEL |= 0x30; // P2.4,5 = USART0 TXD/RXD
P2DIR |= 0x10; // P2.4 output direction
} |
|