刚开始学,求大佬们指教
#include <msp430x14x.h>
typedef unsigned char uchar;
typedef unsigned int uint;
uint FLAG=0;
uint i=0;
void main(void)
{
P1DIR = 0XFF;P1OUT = 0XFF;
P2DIR = 0XFF;P2OUT = 0XFF;
P3DIR = 0XFF;P3OUT = 0XFF;
P4DIR = 0XFF;P4OUT = 0XFF;
P5DIR = 0XFF;P5OUT = 0XFF;
P6DIR = 0XFF;P6OUT = 0XFF;
WDTCTL = WDTPW + WDTHOLD;
CCTL0=CCIE;
CCR0=5000;
TACTL=TASSEL_1+MC_1+TAIE;
P6DIR |= BIT2;P6OUT |= BIT2;
P3SEL |= 0x30;
ME1 |= UTXE0 + URXE0;
UCTL0 |= CHAR;
UTCTL0 |= SSEL0;
UBR00 = 0x0D;
UBR10 = 0x00;
UMCTL0 = 0x6B;
UCTL0 &= ~SWRST;
IE1 |= URXIE0;
_EINT();
// LPM3;
while(1)
{
if(FLAG==1)
{
TXBUF0=++i;
FLAG=0;
}
}
}
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A(void)
{
FLAG=1;
} |