task_console.c
/******************************************************************************
 * This function configures the eUSCI_A0 to be a UART that communicates at
 * 115200 8N1.
 ******************************************************************************/
This function configures the eUSCI_A0 to be a UART that communicates at
115200 8N1.
This function configures the eUSCI_A0 to be a UART that communicates at 115200 8N1 .
static void console_hw_init(void)
{
    P1->SEL0 |= BIT2 | BIT3;
    P1->SEL1 &= ~(BIT2 | BIT3);
    EUSCI_A0->CTLW0 |= EUSCI_A_CTLW0_SWRST; 
    EUSCI_A0->CTLW0 = EUSCI_A_CTLW0_SWRST | 
            EUSCI_B_CTLW0_SSEL__SMCLK; 
    EUSCI_A0->BRW = 13; 
    EUSCI_A0->MCTLW = (0 << EUSCI_A_MCTLW_BRF_OFS) | EUSCI_A_MCTLW_OS16;
    EUSCI_A0->CTLW0 &= ~EUSCI_A_CTLW0_SWRST;
    EUSCI_A0->IFG &= ~(EUSCI_A_IFG_RXIFG | EUSCI_A_IFG_TXIFG);
    EUSCI_A0->IE |= EUSCI_A_IE_RXIE;
    NVIC_EnableIRQ(EUSCIA0_IRQn);
    NVIC_SetPriority(EUSCIA0_IRQn, 2);
    EUSCI_A0->TXBUF = 0;
}
static void console_hw_init ( void ) { P1 -> SEL0 |= BIT2 | BIT3 ; P1 -> SEL1 &= ~ ( BIT2 | BIT3 ) ; EUSCI_A0 -> CTLW0 |= EUSCI_A_CTLW0_SWRST ; EUSCI_A0 -> CTLW0 = EUSCI_A_CTLW0_SWRST | EUSCI_B_CTLW0_SSEL__SMCLK ; EUSCI_A0 -> BRW = 13 ; EUSCI_A0 -> MCTLW = ( 0 << EUSCI_A_MCTLW_BRF_OFS ) | EUSCI_A_MCTLW_OS16 ; EUSCI_A0 -> CTLW0 &= ~ EUSCI_A_CTLW0_SWRST ; EUSCI_A0 -> IFG &= ~ ( EUSCI_A_IFG_RXIFG | EUSCI_A_IFG_TXIFG ) ; EUSCI_A0 -> IE |= EUSCI_A_IE_RXIE ; NVIC_EnableIRQ ( EUSCIA0_IRQn ) ; NVIC_SetPriority ( EUSCIA0_IRQn , 2 ) ; EUSCI_A0 -> TXBUF = 0 ; }
This function configures the eUSCI_A0 to be a UART that communicates at
 115200 8N1.
This function configures the eUSCI_A0 to be a UART that communicates at 115200 8N1 .
// Configure the IO pins used for the UART // set 2-UART pin as secondary function // Put eUSCI in reset // Remain eUSCI in reset // Configure eUSCI clock source // Baurd Rate calculation // 24000000/(16*115200) = 13.020833333 // Fractional portion = 0.20833333 // UCBRFx = int ( (13.020833333-13)*16) = 0 // 24000000/16/115200 // Set the fractional portion of the baud rate and turn // on oversampling // Enable eUSCI in UART mode // Clear any outstanding interrupts. // Enable Rx Interrupt // Enable EUSCIA0 Interrupt // Prime the pump