比如使用UCA0TXD和UCA0RXD,如果直接这样设置:
P1SEL|=BIT2+BIT1;
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 69;
UCA0BR1 = 0;
UCA0MCTL = 0x92;
UCA0CTL1 &= ~UCSWRST;
UCA0IE |= UCRXIE;
还是需要先设置PORT MAP寄存器呢? 比如这样:
PMAPPWD = 0x02D52; // Enable Write-access to modify port mapping registers
PMAPCTL = PMAPRECFG; // Allow reconfiguration during runtime
P1MAP1 |= PM_UCA0TXD.;
P1MAP2 |= PM_UCA0RXD.;
PMAPPWD = 0;
P1SEL|=BIT2+BIT1;