+ // Pin Setup for UART0
+ PORTB_PCR16 = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3); // RX Pin
+ PORTB_PCR17 = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3); // TX Pin
+
+ // Setup baud rate - 1205 Baud
+ // 48 MHz / ( 16 * Baud ) = BDH/L
+ // Baud: 1205 -> 48 MHz / ( 16 * 1205 ) = 2489.6266
+ // Thus baud setting = 2490
+ // NOTE: If finer baud adjustment is needed see UARTx_C4 -> BRFA in the datasheet
+ uint16_t baud = 2490; // Max setting of 8191
+ UART0_BDH = (uint8_t)(baud >> 8);
+ UART0_BDL = (uint8_t)baud;
+
+ // 8 bit, Even Parity, Idle Character bit after stop
+ UART0_C1 = ~UART_C1_M | UART_C1_PE | ~UART_C1_PT | UART_C1_ILT;
+
+ // Number of bytes in FIFO before TX Interrupt
+ UART0_TWFIFO = 1;
+
+ // Number of bytes in FIFO before RX Interrupt
+ UART0_RWFIFO = 1;
+
+ // TX FIFO Disabled, TX FIFO Size 1 (Max 8 datawords), RX FIFO Enabled, RX FIFO Size 1 (Max 8 datawords)
+ // TX/RX FIFO Size:
+ // 0x0 - 1 dataword
+ // 0x1 - 4 dataword
+ // 0x2 - 8 dataword
+ UART0_PFIFO = ~UART_PFIFO_TXFE | /*TXFIFOSIZE*/ (0x0 << 4) | ~UART_PFIFO_RXFE | /*RXFIFOSIZE*/ (0x0);
+
+ // TX Disabled, RX Enabled, RX Interrupt Enabled
+ UART0_C2 = UART_C2_TE | UART_C2_RE | UART_C2_RIE;
+
+ // Reciever Inversion Disabled
+ UART0_S2 = ~UART_S2_RXINV;
+
+ // Transmit Inversion Disabled
+ UART0_C3 = ~UART_S2_TXINV;
+
+ // Add interrupt to the vector table
+ NVIC_ENABLE_IRQ( IRQ_UART0_STATUS );