LoginSignup
0
1

More than 5 years have passed since last update.

MSP430 > UART > 4800bpsの設定

Last updated at Posted at 2017-03-01
動作環境
MSP430F2x

4800bpsのGPSを読み取る場合、UARTの設定は以下のようになる。

void uartPC_init(void)
{
    P3SEL |= 0x30;                            // P3.4,5 = USART0 TXD/RXD
    ME2 |= UTXE0 + URXE0;                     // Enable USART0 TXD/RXD
    UCTL0 |= CHAR;                            // 8-bit character
    UTCTL0 |= SSEL0;                          // UCLK = ACLK
    // 9600bps
    //UBR00 = 0x03;                             // 32k/9600 - 3.41
    //UBR10 = 0x00;                             //
    //UMCTL0 = 0x4A;                            // Modulation
    // 4800bps
    UBR00 = 0x06;                             // 
    UBR10 = 0x00;                             //
    UMCTL0 = 0xEF;                            // Modulation
    //
    UCTL0 &= ~SWRST;                          // Initialize USART state machine
    IE2 |= URXIE0;                            // Enable USART0 RX interrupt  
}

参考 http://www.win.tue.nl/san/education/2IN26/MSP430%20UART.pdf
のTable 2.

本家の資料では
http://www.ti.com/sc/docs/products/micro/msp430/userguid/ag_12.pdf
のTable 12.1にてUBR00は0x06で、UMOD(UMCTL0)は0x6Fという記載もある。

前者ではMEAN ERRORが-0.71%で、後者はmax errorが-9/11%。異なる値ではどちらがいいとも言えない。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1