This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

初始化msp430f5152的UCA0时需要先设置port map吗?

比如使用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;