我用串口调试助手调试 没动静啊
以下是程序
#include <msp430x14x.h>
static char string1[8];
char i;
char j = 0;
void main( void )
{
WDTCTL = WDTPW + WDTHOLD;
P3SEL |= 0x30;
ME1 |= UTXE0 + URXE0;
UCTL0 |= CHAR;
UTCTL0 |= SSEL0;
UBR00 = 0x03;
UBR10 = 0x00;
UMCTL0 = 0x4a;
UCTL0 &= ~SWRST;
IE1 |= URXIE0 + UTXIE0;
IFG1 &= ~UTXIFG0;
_BIS_SR(LPM3_bits + GIE);
}
#pragma vector = UART0TX_VECTOR
__interrupt void tx0()
{
if(i < sizeof string1)
TXBUF0 = string1[i++];
}
#pragma vector = UART0RX_VECTOR
__interrupt void rx0()
{
string1[j++] = RXBUF0;
if(j > sizeof string1 -1)
{
i = 0;
j = 0;
TXBUF0 = string1[i++];
}
}
此帖出自
小平头技术问答
一周热门 更多>