Vincent Belanger
/
APP
APP 1 S5.
Diff: UART.cpp
- Revision:
- 10:f58cbb203c59
- Parent:
- 9:f35a5cde61a3
--- a/UART.cpp Mon Jan 11 19:07:16 2016 +0000 +++ b/UART.cpp Mon Jan 11 19:32:05 2016 +0000 @@ -1,14 +1,20 @@ +// UART.cpp +// Vincent Belanger - belv1802 +// Jeremy Pare - parj2713 + #include <stdint.h> #include "UART.h" #include "APP.h" #include "LPC17xx.h" + void UARTInit(uint32_t baudrate) { uint32_t Fdiv; uint32_t pclkdiv, pclk; + // Select UART3 LPC_PINCON->PINSEL0 &= ~0x00000003; LPC_PINCON->PINSEL0 |= 0x00000002; @@ -34,10 +40,9 @@ LPC_UART3->LCR = 0x83; // 8 bits, no Parity, 1 Stop bit, DLAB = 1 Fdiv = (pclk / 16) / baudrate; // baud rate - LPC_UART3->DLM = Fdiv / 256; - LPC_UART3->DLL = Fdiv % 256; + LPC_UART3->DLM = Fdiv / 256; // MSB + LPC_UART3->DLL = Fdiv % 256; // LSB LPC_UART3->LCR = 0x03; // DLAB = 0 - LPC_UART3->FCR = 0x07; } void UARTSend(uint8_t byte)